[https://nvbugs/6270671][fix] Replace the hardcoded multiBlock=1 with a call to… - #15312
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe HMMA speculative-decoding code path now computes multi-block grid dimensions using ChangesHMMA Speculative-Decoding Multi-Block Grid Tuning
🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Hi @pengbowang-nv, is mha.cu spec-dec + multi-block mode supported? (accuracy validated?) Also, one problem with computeMultiBlockCountSpecDecGMMA was, it took max_seq_len (history kv) as a tunable heuristic, but actual behavior is the variable is fixed during cuda graph capture (a longest ISL prompt was sent during capture), and no matter the actual ISL is during actual serving, it's always selecting the config captured by longest ISL. This can and should be addressed for both GMMA and HMMA for perf. Thanks! cc @mikeiovine |
|
Hi @jhaotingc , I think we haven't done such experiment before. I think the kernel should support it but I'll need to run some test to be sure.
Regarding this, it is hard to do so because cuda graph would keep kernel launch parameter and execute no CPU code, which means it just "remembers" a config during capture. We may have some solutions, like having a cudagraph dedicated for short sequence length. Or maybe we can try change the kernel to decide multiblock num in kernel, so that the kernel would work as a persistent kernel, it may launch maximum number of CTAs but will only use some of them at runtime and let other early exit. |
|
I have verified in unit test that the kernel would work with multiblock spec-dec. |
|
Sounds good, thank you! @pengbowang-nv |
…ernel PR NVIDIA#4416 enabled multi-block mode for the FP8 (GMMA) spec-dec XQA kernel on Hopper, but the same treatment was never applied to the BF16 (HMMA) spec-dec XQA kernel. On Hopper SM=90 with BF16 input + BF16 KV cache (e.g. GPT-OSS-120B + Eagle3), the GMMA path is rejected by supportConfigQGMMA (requires E4M3 KV or skip-softmax), so the launch falls back to the HMMA kernel with multiBlock hardcoded to 1. At ISL=32k, concurrency=1 the resulting ~4-CTA grid cannot saturate the SMs, so per-token latency dominates and Eagle3 acceptance ~1.8 fails to translate into an end-to-end speedup. Wire computeMultiBlockCountSpecDecGMMA into the HMMA spec-dec branch. The HMMA gridDim is {multiBlock, nbKVHeads * nbTokenBlocksPerGrp, batchSize}, so passing nbTokenBlocksPerGrp where the GMMA path passes specDecBlocks gives the helper the correct singleBlockCount and reuses the existing wave-count / history-aware tuning. The mha.cu kernel already implements the SPEC_DEC multi-block reduction (gridDim.x splits, per-(head, q-token) sub-sequence indexing, scratch + semaphore handling sized via gridDim.y), so no kernel-side change is needed. Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com>
Signed-off-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com>
8b52322 to
0474212
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #54499 [ run ] triggered by Bot. Commit: |
|
PR_Github #54499 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #54579 [ run ] triggered by Bot. Commit: |
|
PR_Github #54579 [ run ] completed with state |
|
/bot run --stage-list "DGX_H200-8_GPUs-PyTorch-PerfSanity-Post-Merge-1" |
|
PR_Github #54769 [ run ] triggered by Bot. Commit: |
|
PR_Github #54769 [ run ] completed with state
|
|
Previous run is just a perf instability. Not blocking nor caused by this PR. |
|
/bot run |
|
PR_Github #54785 [ run ] triggered by Bot. Commit: |
|
PR_Github #54785 [ run ] completed with state |
…ec-dec (NVIDIA#15312) Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com> Signed-off-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com> Co-authored-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com> Signed-off-by: GitLab CI Bot <gitlab-ci@nvidia.com>
…ec-dec (NVIDIA#15312) Signed-off-by: tensorrt-cicd <90828364+tensorrt-cicd@users.noreply.github.com> Signed-off-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com> Co-authored-by: Pengbo Wang <221450789+pengbowang-nv@users.noreply.github.com> Signed-off-by: GitLab CI Bot <gitlab-ci@nvidia.com>
Summary
Test plan
Links
Summary by CodeRabbit