Skip to content

[Perf] [ROCM] diffusion: Pipeline MiniMax-H3's Ulysses exchange over head groups on RCCL - #47567

Merged
mickqian merged 1 commit into
mainfrom
mick/rocm-h3-ulysses-pipeline
Oct 31, 2026
Merged

mickqian merged 1 commit into
mainfrom
mick/rocm-h3-ulysses-pipeline

Conversation

@mickqian

@mickqian mickqian commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Without the copy-engine transport (ROCm), each H3 layer packs q/k/v, waits on the input all-to-all, attends, then waits on the output all-to-all: ~2.5 ms of exposed RCCL per layer at 1280x704 on 4xMI355X (14.5% of a denoise step).

Modifications

  • Split the local heads into two groups: queue both input exchanges up front on the collective stream, and send group g's output while group g+1 attends. aiter attends a head group with the same bytes as inside the full call (verified), so the output is bit-identical.
  • Two groups was the best choice: 7 groups, 14 groups and unequal splits ([4,10], [2,10,2]) are all slower because attention gets a partial extra wave per call.
  • Test added to test_usp_pipelined_attention_multi_gpu.py.

Accuracy Tests

Bit-identical output: 22/22 MP4 md5s equal to main in the final run.

Speed Tests and Profiling

Setup for all numbers below: 4x MI355X, MiniMax-H3 T2VA, 1280x704 (SemiAnalysis "720p"), 124 frames, 49 forwards, Ulysses 4 + aiter, single stream. Each arm is a fresh server (1 warmup + 3 timed requests), ABAB across two rounds, base = main 75a5da7f.

720p median -3.24 s (the largest single item). Per step, ~63 ms of RCCL is now hidden behind attention; 849.5 -> 738 ms/step together with the QK norm change.

Note: this touches the same H3 pipelined-Ulysses block in minimax_h3.py as the CUDA-side PR that skips the packing's alignment rows; whichever lands second needs a small rebase.

Checklist

  • Format your code according to the pre-commit config (isort / ruff / black pass).
  • Add unit tests (merged into the existing test file for the touched area).
  • Provide accuracy and speed benchmark results (above).

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ✅ Run #41159187045
Latest PR Test (Extra): ❌ Run #41159187112
Latest PR Test (AMD ROCm 10): ❌ Run #41159187001

…oups on RCCL

Without the copy-engine transport (ROCm), each H3 layer packs q/k/v, waits on
the input all-to-all, attends, then waits on the output all-to-all: ~2.5 ms of
exposed RCCL per layer at 1280x704 on 4xMI355X. Split the local heads into two
groups: queue both input exchanges up front on the collective stream and send
group g's output while group g + 1 attends. aiter attends a head group with the
same bytes as inside the full call, so the output is bit-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@github-actions

This comment has been minimized.

@mickqian

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 31, 2026
@mickqian mickqian changed the title [Perf] [ROCm] diffusion: Pipeline MiniMax-H3's Ulysses exchange over head groups on RCCL [Perf] [ROCM] diffusion: Pipeline MiniMax-H3's Ulysses exchange over head groups on RCCL Oct 31, 2026
@mickqian
mickqian merged commit e93f817 into main Oct 31, 2026
250 of 280 checks passed
@mickqian
mickqian deleted the mick/rocm-h3-ulysses-pipeline branch October 31, 2026 12:27
niehen6174 added a commit to niehen6174/sglang that referenced this pull request Nov 5, 2026
Reviewed the six upstream minimax_h3.py changes since the last pin
(sgl-project#46047, sgl-project#46709, sgl-project#47567, sgl-project#47569, sgl-project#47566 and the BCG output buffers). None
touches what h3_comfyui_v1 relies on in its single-GPU eager torch_sdpa
profile: DiTBlock.forward is unchanged, _attend still calls
fused_inplace_qknorm_rope on the _use_fused_qknorm_rope branch with the same
arguments (the new pipelined branch needs Ulysses, which the profile
rejects), and _embed still returns (embeddings, t_emb) in eager mode.
Yuxingwang-intel pushed a commit to Yuxingwang-intel/sglang that referenced this pull request Nov 6, 2026
…head groups on RCCL (sgl-project#47567)

Co-authored-by: Mick Qian <mickqian@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant