Skip to content

Wan ulysses bshd attention#404

Draft
csgoogle wants to merge 5 commits into
mainfrom
wan-ulysses-bshd-attention
Draft

Wan ulysses bshd attention#404
csgoogle wants to merge 5 commits into
mainfrom
wan-ulysses-bshd-attention

Conversation

@csgoogle
Copy link
Copy Markdown
Collaborator

No description provided.

sagarchapara and others added 5 commits April 29, 2026 19:57
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.
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 12, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants