feat: experimental two-phase (head-chunked) Ulysses all-to-all#428
Open
csgoogle wants to merge 1 commit into
Open
feat: experimental two-phase (head-chunked) Ulysses all-to-all#428csgoogle wants to merge 1 commit into
csgoogle wants to merge 1 commit into
Conversation
|
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. |
7240f50 to
0d936f8
Compare
Perseus14
reviewed
Jun 24, 2026
| # math is identical to the single-shot path (heads are independent); requires | ||
| # async-collective LIBTPU flags to actually overlap, and the per-chunk head | ||
| # count must still be shardable across the context axis. | ||
| num_chunks = int(os.environ.get("ULYSSES_ATTENTION_CHUNKS", "1")) |
Collaborator
There was a problem hiding this comment.
Let's move this to config file to be used for any ulysses type kernel
| f"got heads={num_heads} and context_shards={num_shards}." | ||
| ) | ||
|
|
||
| # EXPERIMENTAL: split the all-to-all into `num_chunks` head-groups so XLA's |
Collaborator
There was a problem hiding this comment.
Does this work on ulysses + ring as well?
Collaborator
Author
There was a problem hiding this comment.
yes, updated the code.
0d936f8 to
14eb661
Compare
Add a ulysses_attention_chunks attention config to split the Ulysses all-to-all into head-group passes. The chunked path lets XLA overlap all-to-all collectives with head-parallel local attention compute while preserving the existing single-shot path by default. Apply the same chunking to plain Ulysses and Ulysses+Ring, and allow the final chunk to carry the remainder when the requested chunk count does not divide the Ulysses head groups evenly. Add mocked attention tests for numerical and layout equivalence across chunk counts.
14eb661 to
e09195e
Compare
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.
Add an opt-in ULYSSES_ATTENTION_CHUNKS env var to split the Ulysses all-to-all into per-head-group passes, so XLA's async-collective scheduler can overlap one group's attention compute with the next group's all-to-all. Defaults to 1 (current single-shot path, no behavior change). Numerically identical to single-shot since heads are independent.
Notes: