Repository navigation
[Diffusion][MiniMax-H3] Add SM120 Sage compute for SubBlock sparse attention - #40116
Conversation
BBuf
left a comment
There was a problem hiding this comment.
No blocking issue found in the SM120 adapter. I checked the Q64/K64 geometry, quantized tensor order/layout, and partial-block/per-row-count forwarding against the referenced FlashInfer source. My checks covered source-level dispatch and adapter arguments; I did not independently rerun the SM120 numerical or end-to-end benchmarks. One small documentation suggestion is inline.
|
|
||
| Enable it on SM90 with: | ||
| SM120 requires FlashInfer's CuTe-DSL SM120 Sage backend and | ||
| `quantize_sage_qkv_sm120`. |
There was a problem hiding this comment.
Non-blocking: could we include a source-install link/command or the minimum FlashInfer version providing both SM120 Sage symbols here? The default FlashInfer pin remains 0.6.18; the PR description points to flashinfer-ai/flashinfer#4691 and the tested commit, but users following this README only get the symbol names. Carrying that installation guidance into the README would make the opt-in mode easier to use.
There was a problem hiding this comment.
Thanks for the review. I'll add the FlashInfer source-installation guidance and the tested commit to the README so users can enable SM120 Sage without referring to the PR description.
There was a problem hiding this comment.
Exact-head CI follow-up: CPU(0) job106038117734 fails test_disagg_idle_step_counters.py because Scheduler lacks _prev_prefill_end_ts; CPU(6) job106038117740 fails test_pdmux_split_prefill_schedules_auxiliary_output_copy because its batch fixture lacks split_index. These are scheduler-fixture compatibility failures, not evidence of an SM120 Sage regression. Update: main now contains the upstream fixture repair #40411, commit22f02cc3399dcd59380fc546de8d3c89fba6fa3a (including completion timing, burst accounting, and additional regression coverage). Please merge updated main instead of rerunning the stale fixtures or applying the earlier #39206 variants. Maintainer edits are disabled for this head and I have no push permission, so this is an author-action follow-up. No unchanged-fixture rerun requested.
Motivation
Extend MiniMax-H3's SubBlock Sage compute mode from SM90 (#37982) to SM120 using FlashInfer's CuTe-DSL backend. On 8 RTX PRO 5000 GPUs, Sage reduces generation time by 3.86%–14.86% compared with BF16 SubBlock across the evaluated task/duration groups.
Modifications
n_k=4, preserving 16-token key pooling cells.The mode is opt-in; BF16 remains the default. SM90 retains its existing Q64 × K128 Sage path, and SM100 remains BF16-only.
--attention-backend subblock_sparse_attn \ --attention-backend-config '{"compute_mode":"sage_fp8"}'Dependency: requires flashinfer-ai/flashinfer#4691. Benchmarks used FlashInfer source commit
6a84331e. Users enabling SM120 Sage need a source installation containing this change; the default FlashInfer0.6.18pin is unchanged.Accuracy Tests
The new SM120 Sage numerical test covers partial blocks, variable block counts, and empty rows against an FP32 reference. It passed on SM120 hardware and remains a manual test pending the required FlashInfer dependency in CI.
All comparisons below use the same inputs and seeds. SB denotes SubBlock BF16, and SB+Sage denotes SubBlock Sage FP8. The dense reference uses Torch SDPA on SM120.
Video SSIM
SSIM is measured against the matching dense video over all frames, with YUV420 weighting
(4Y + U + V) / 6. Values are means across three seeds.The difference between SB+Sage and SB in group-mean SSIM against dense ranges from -0.002290 to +0.000983.
Audio similarity
Decoded audio is compared against the matching dense output. Values are means across three seeds, in dB. Higher waveform SNR and lower log-mel MAE indicate closer signals.
The original 32 kHz stereo audio is retained. Log-mel MAE uses 80 Slaney mel bands, a 2048-sample Hann window/FFT, a 512-sample hop, and a shared floor 80 dB below the reference mel peak.
Comparing SB+Sage directly against SB, group-mean SNR ranges from 13.93 to 21.44 dB and log-mel MAE from 0.472 to 1.658 dB.
Speed Tests and Profiling
Benchmarked MiniMax-H3 on 8 NVIDIA RTX PRO 5000 GPUs (SM120) with PyTorch
2.13.0+cu130, CUDA 13.0, TP=2, Ulysses SP=4, and text-encoder layerwise offload. All modes use 50 requested inference steps andquality="lossless".Sparse settings:
sparsity=0.75,n_q=n_k=4,skip_first_steps=10,skip_first_layers=0, andmin_seq_len=4096.Generation time
Mean server-side generation time across three seeds, excluding one complete warmup request per mode, task, and duration. The ↓ columns report time reduction relative to dense SDPA:
(dense time - method time) / dense time.Sage is faster than BF16 SubBlock in all 27 matched-seed comparisons, reducing group-mean generation time by 3.86%–14.86%.
Peak reserved memory
Measured by the PyTorch allocator on the output rank. Values are the maximum per-request peak across three seeds, excluding warmup, in GiB.
Peak reserved memory differs from BF16 SubBlock by -0.04 to +0.27 GiB across the measured groups.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #35497377460
Latest PR Test (Extra): ❌ Run #35497377163
Latest PR Test (AMD ROCm 10): ⏳ Run #35497377350