Wan ulysses bshd attention#404
Draft
csgoogle wants to merge 5 commits into
Draft
Conversation
Adds dedicated `ring` and `ulysses` mesh axes so hybrid context parallelism does not interfere with weight TP sharding rules. Rewrites _ulysses_attention to keep tensors in BSHD layout through the all-to-all collective, avoiding a full-sequence BHSD transpose before the redistribution — ~34% faster than the original implementation and 8% faster than plain ring at dp=2 cp=8 on v7x-16. - common_types: add RING/ULYSSES axis name constants and axis rules for ulysses_ring hybrid (sequence sharded over [ring, ulysses]) - configs: add ici/dcn ring+ulysses parallelism params and updated mesh_axes, logical_axis_rules, data_sharding, and flash block sizes for all WAN configs - max_utils: extend create_device_mesh to append ring/ulysses axes when present - attention_flax: BSHD-native _ulysses_attention; new _ulysses_ring_attention combining Ulysses all-to-all (ulysses axis) with Tokamax ring (ring axis); routing and cross-attention fallback wired in _apply_attention - pyconfig: prepend ULYSSES_RING_ATTENTION_AXIS_RULES for ulysses_ring modes - bench_remaining.sh, docs: multihost benchmark harness and results
bench_attn.sh: 6 attention strategies × 4 batch sizes (bs 1/2/4/8) on v7x-16, profiler only for bs=2. Updated XLA flags: LHS rerun=5, max_concurrent_async_collective_permutes=16, ici_ag_pipelining=true. docs/tpu_wan_bench_guide.md: how to launch benchmarks, view xprof traces, sync code to worker1, clear TPU locks after crashes, and parse results.
Applies the same BSHD-native layout used in _ulysses_attention to _ulysses_ring_attention: all-to-all operates on the smaller post-shard head dimension, deferring the BHSD transpose until after the collective. Also routes ulysses_ring through the BSHD RoPE path in FlaxWanAttention.
… v7-8 benchmark script
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.