[None][fix] Restore SM107 2x-mmaK acceptance and fine-grained sync PDL path - #18974
[None][fix] Restore SM107 2x-mmaK acceptance and fine-grained sync PDL path#18974farazkh80 wants to merge 2 commits into
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 ignored due to path filters (2)
📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughChangesGEMM runtime updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to This restores SM107a GEMM/MoE configuration support, alignment handling, and diagnostics. No current merge-readiness risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…L path Three fixes surfaced while measuring the fine-grained (Lamport) MoE sync feature (NVIDIA#17707) on Rubin: 1. trtllmGen_bmm_export/GemmOptions.h lost the SM107 2x-mmaK acceptance (mmaK 64 for FP8/MxFP8, 128 for FP4) when the export filter stripped the internal-only guards. Every sm107a batched-GEMM cubin with those mmaK values failed checkAndUpdateGemmOptions and was silently rejected by getValidConfigIndices/getDefaultValidConfigIndex, so the MoE runners fell back to sm100f kernels. This makes use_fine_grained_sync a no-op for NVFP4/FP8/MxFP8 MoE on SM107, and no sm107a-specific MoE GEMM cubin is ever dispatched on Rubin regardless of the flag. 2. BatchedGemmInterface.h's PDL-safety check did not include the fine-grained consumer flags, so the FC2 consumer always launched without programmatic dependent launch and could never start before FC1 completes, defeating the point of the protocol. 3. PermuteGemm1::Runner::{getDefaultValidConfigIndex,isValidConfigIndex} validated against the unrounded valid hidden size while run() launches with the size rounded up to 512 for MxE4m3 activations, so validity and the actual launch could disagree on K. Also: MxFp8Fp6Fp4 (MxE4m3 activation) mmaK=64 SM107a kernels hang when FC1 and FC2 both dispatch to this kernel family back to back on the same stream (confirmed with CUDA_LAUNCH_BLOCKING=1 that FC1 completes and FC2's launch never returns; a forced cudaStreamSynchronize between the two GEMMs does not help, ruling out a host-side memory-ordering race). Either GEMM alone, paired with the other on sm100f, runs fine, as do the NVFP4 (mmaK=128) and BF16-cast (mmaK=16) SM107a pairs. Disabled via skipQuirks until the kernel-side issue is root-caused in trtllm-gen; this keeps w4a8 GPT-OSS MoE on the existing sm100f fallback rather than hanging once (1) is fixed. Verified on 4x Rubin (SM107): NVFP4 (DeepSeek-V3 shapes) dispatches the full sm107a config space including the fine-grained producer/consumer pair across 4/32/128/512 tokens; GPT-OSS w4a8 (MxFP4 x MxFP8) falls back to sm100f cleanly with no hang across the same token range. Signed-off-by: Faraz Khoubsirat <58580514+farazkh80@users.noreply.github.com>
a31b6e1 to
f8e1eef
Compare
…xports The public export dropped the Rubin branch of dtypeNeedsPadding and getNumSmemBitsPerElt. For SM107a 2x-mmaK MxFP8 kernels (mmaK 64, or 128 with sparse A) the host therefore built the MxE2m1 weight tensor map in padded-FP4 mode while the cubin expects unpadded data, so the TMA load never completed the mbarrier transaction and every warp spun on its pipeline barriers. Restore the rule in the batchedGemm and gemm exports and drop the skipQuirks ban that papered over it. Signed-off-by: Faraz Khoubsirat <58580514+farazkh80@users.noreply.github.com>
24e7d79 to
cd506e4
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #72787 [ run ] triggered by Bot. Commit: |
Summary
Restores SM107 fine-grained (Lamport) MoE sync (#17707) to actually dispatch on Rubin, plus a
kernel-hang workaround discovered while validating it.
1. SM107 2x-mmaK acceptance was dropped from the public export
trtllmGen_bmm_export/GemmOptions.h::checkAndUpdateGemmOptionsno longer accepts mmaK=64(FP8/MxFP8) or mmaK=128 (FP4) on SM107a — those checks were guarded internally and stripped by
the export filter. Every SM107a batched-GEMM cubin with these mmaK values therefore fails
validation, so
getValidConfigIndices/getDefaultValidConfigIndexthrow and the MoE runnerssilently fall back to SM100f kernels. This makes
use_fine_grained_synca no-op forNVFP4/FP8/MxFP8 MoE on SM107 — no SM107a-specific MoE GEMM cubin is ever selected, regardless
of the flag, and the
*_fine_grained_syncaccuracy tests pass vacuously.2. Fine-grained consumer launched without PDL
BatchedGemmInterface.h::run'spdlSafecheck didn't includemFineGrainedConsumerA/mFineGrainedConsumerB, so the FC2 consumer always launched withoutprogrammatic dependent launch and could never start before FC1 completes — defeating the
producer/consumer overlap the protocol is for.
3. FC1 validity check used an unrounded valid hidden size
PermuteGemm1::Runner::{getDefaultValidConfigIndex,isValidConfigIndex}validate againstvalidHiddenSizeas passed in, whilerun()rounds it up to 512 forMxE4m3activations beforelaunching. Made the two consistent.
4. SM107 2x-mmaK MxE2m1 padding rule was dropped from the exports
Once (1) is fixed, every
MxFp8Fp6Fp4(MxE4m3 activation) mmaK=64 SM107a batched-GEMM kernel hungon its first launch, fine-grained sync on or off. Root cause: the export also stripped the Rubin
branch of
trtllm/gen/DtypeDecl.h::dtypeNeedsPadding(andKernelTraits.h::getNumSmemBitsPerElt),so the host built the MxE2m1 weight tensor map in padded-FP4 mode while the cubin, generated with
Rubin features, consumes unpadded data. The TMA load never completes the mbarrier transaction and
every warp spins in
SYNCS.PHASECHK.TRANS64.TRYWAIT(cuda-gdb). Proven by dumping the launchparameters on this branch vs the internal branch for the identical kernel: only the operand-A tensor
map differed, by the padding bit. Restored in both
trtllmGen_bmm_exportandtrtllmGen_gemm_export(the dense export ships 12 sm107a mmaK=64 MxE2m1 kernels with the same exposure). The interim
skipQuirksfamily ban from the first revision of this PR is removed.Test coverage
Verified on a 4x Rubin (SM107) box via
tests/microbenchmarks/bench_moeand trtllm-gen'sstandalone
BatchedGemmFC1→FC2 harness:--quant NVFP4, SM100f excluded to force full SM107a coverage):all 65 distinct SM107a FP4 cubin variants dispatch across 4/32/128/512 tokens, including the
fine-grained producer (
_fgFV_fgP) / consumer (_fgCB) pair. No hang.--quant W4A8_MXFP4_MXFP8,use_fine_grained_sync=True): completes cleanlyacross 4/32/128 tokens with zero SM107a kernels selected (clean fallback via the
skipQuirksentry in (4)), matching pre-[TRTLLM-15316][feat] Rubin trtllmgen batchedGemm MoE #17707 behavior — no hang, no regression.
kernels/BatchedGemm/BatchedGemmFc1Fc2LamportRepro.cppin the trtllm-gen tree): 2000 replays ofthe FC1(tileK=512,splitK=2)/FC2(tileK=256) pair with fine-grained sync off completed cleanly;
the same pair with fine-grained sync on requires internal SASS-patch tooling
(
nvdisasm_internal/nvasm_internal) not available in this environment, so it could not bebuilt/run standalone, but the TRT-LLM-level
CUDA_LAUNCH_BLOCKINGisolation above used the realproduction cubins directly and is conclusive for that case.
TLLM_BATCHED_GEMM_PRINT_NAME=1logging in all cases.I don't have a way to run the standard CI test suite from this environment; happy to address CI
feedback.
Dev Engineer Review
mmaKconfigurations inGemmOptions.mmaK=64kernels remain implementation-sensitive and require continuedskipQuirksmanagement.QA Engineer Review
No test changes.
Per-File QA Perspective
cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/BatchedGemmInterface.h: Verify PDL safety decisions for fine-grained producer and consumer combinations.cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/GemmOptions.h: Verify SM107a accepts the intended FP8/MxFP8/FP4/MxFP4mmaKconfigurations and rejects them on unsupported architectures.cpp/tensorrt_llm/kernels/trtllmGenKernels/blockScaleMoe/runner.cu: Verify configuration selection matches launch-time hidden-size rounding for MXFP4 weights with E4M3 activations.cpp/tensorrt_llm/thop/mxFp4BlockScaleMoe.cpp: Verify missing-runner diagnostics appear at warning level for BF16 and MXE4m3 paths.cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/trtllmGen_bmm_export/KernelTraits.h: Verify native dtype-width shared-memory calculations for densemmaK >= 64and sparsemmaK >= 128.cpp/tensorrt_llm/kernels/trtllmGenKernels/gemm/trtllmGen_gemm_export/KernelTraits.h: Verify GEMM shared-memory calculations remain unchanged for non-Rubin and lower-mmaKconfigurations.