[WAN 2.2] 2D Ring Attention with Custom Kernel#430
Open
eltsai wants to merge 1 commit into
Open
Conversation
Collaborator
Author
Perseus14
reviewed
Jun 26, 2026
csgoogle
reviewed
Jun 26, 2026
955a5ba to
2a699ca
Compare
|
🤖 Hi @csgoogle, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
csgoogle
previously approved these changes
Jun 26, 2026
|
🤖 I'm sorry @csgoogle, but I was unable to process your request. Please see the logs for more details. |
csgoogle
reviewed
Jun 26, 2026
| from_pt: True | ||
| split_head_dim: True | ||
| attention: 'flash' # Supported attention: dot_product, flash, tokamax_flash, cudnn_flash_te, ring, tokamax_ring, ulysses, ulysses_custom, ulysses_ring | ||
| attention: 'flash' # Supported attention: dot_product, flash, tokamax_flash, cudnn_flash_te, ring, tokamax_ring, tokamax_ring_custom, ulysses, ulysses_custom, ulysses_ring, ulysses_ring_custom, ulysses_ring_custom_bidir |
Collaborator
There was a problem hiding this comment.
nit: can we comment the best flashblock sizes here itself, it would be easy for anypne to look into
2a699ca to
7528f71
Compare
csgoogle
approved these changes
Jun 26, 2026
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.



Summary
In this PR, we are adding support for
(also formatting
src/maxdiffusion/loaders/ltx2_lora_nnx_loader.pyto remove formatting errors)Results
Compared with previous best config
For dp2-cp4 on v7x-8, we see:
which is a 11% speedup comparing best Ulysses config for the denoising step (9% e2e time):
Best Configs
The 2D-ring (Ulysses×Ring) hybrid is optimal at cp4 and cp16, and ties pure Ulysses at cp8. Pure Ulysses never strictly wins.
Compared with ring attention
Using the custom kernel as base for ring attention gives a ~23% per-denoising-step speedup (cp=4: 4.85 → 3.74 s/step, BQ=4096).
A tile-size (BQ) search found the optimal ring tile is BQ=9472 for R<=8, and BQ=4096 for R>=16. It's worth ~19% speedup (dp1-cp8 U=4: 1.98→1.60 s/step at BQ 4096→9472).
For more details, see the internal doc
Note on bi-directional (wrap-free) ring attention.
Because of TPU topology, when
R_degree >= 8we start to see slow downs due to communication. I did some PoC on bi-directional ring, and see improvements for some cases whenR_degree=16. I think it would be more beneficial when we scale up, so I am including it in this PR (despite that it doesn't give us optimal results on CP4, CP8 and CP16).