Repository navigation
[None][perf] Build FlashMLA without relocatable device code - #22028
Conversation
The flash_mla_cpp_tllm target was built with CUDA_SEPARABLE_COMPILATION, i.e. nvcc -rdc=true. Nothing in FlashMLA needs cross-TU device linking (its own setup.py builds without -rdc), and -rdc makes ptxas spill in the attention kernels: sm90 sparse prefill (d_qk 512) 0 -> 2044 B spill stores, 296 B stack sm90 sparse fp8 decode (h64) 0 -> 220 B sm100 sparse prefill (h128) 0 -> 44 B sm100 sparse decode (h64) 0 -> 12 B H200, flash_mla_sparse_fwd with 13312 queries x 64 heads x 2176 top-k rows (d_qk 512): 17.07 ms -> 7.85 ms, outputs bit-identical. Same FlashMLA commit and nvcc; only the -rdc flag differs. Signed-off-by: Ruocheng Jia <[email protected]>
|
No actionable comments were generated in the recent review. WalkthroughThe FlashMLA CMake target now disables CUDA separable compilation and no longer enables device-symbol resolution. The adjacent comment about generating ChangesFlashMLA build configuration
Estimated code review effort: 1 (Trivial) | ~3 minutes Change: Bug fix Suggested labels: Merge Risk:
|
|
@farazkh80, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
|
/bot run |
|
PR_Github #83846 [ run ] triggered by Bot. Commit: |
|
PR_Github #83846 [ run ] completed with state
|
|
/bot run |
|
PR_Github #83904 [ run ] triggered by Bot. Commit: |
|
PR_Github #83904 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #83915 [ run ] triggered by Bot. Commit: |
|
PR_Github #83915 [ run ] completed with state |
|
Automatically added "ci: full pre-merge approved" because this PR has satisfied the required GitHub review approvals. Unresolved review conversations and other required checks remain independent merge requirements. |
Description
Split out of #21178 at review request so attention owners can review the FlashMLA build change on its own; #21178
keeps the CUTLASS MoE kernel changes.
flash_mla_cpp_tllmwas built withCUDA_SEPARABLE_COMPILATION ON(nvcc -rdc=true). Nothing in FlashMLA needscross-TU device linking (its own
setup.pybuilds without-rdc; there are noextern __device__/__constant__symbols, out-of-TU__device__functions, or device-side launches, and the target links without-rdc), and-rdcmakes ptxas spill in the attentionkernels:
H200,
flash_mla_sparse_fwdwith 13312 queries x 64 heads x 2176 top-k rows (d_qk 512): 17.07 -> 7.85 ms per call,outputs bit-identical. Same FlashMLA commit and nvcc; only
-rdcdiffers.End to end, GLM-5.3-Flash FP8 on H200 (TP4, MTP3, BF16 KV cache; main 37e6e67 + #21179 with and without this PR,
CI wheels, two runs each): C1 TTFT 619 -> 495 ms at ISL 13312, 228 -> 189 ms at ISL 4096, 101 -> 91 ms at ISL 1024;
C8 output throughput 53.1 -> 65.6 tok/s at ISL 13312; decode unchanged. The change applies to every FlashMLA kernel
built in this target (SM90 and SM100).
Test Coverage
unittest/_torch/attentionon H100/B200 (outputs bit-identical).PR Checklist
Dev Engineer Review
flash_mla_cpp_tllmnow disables CUDA separable compilation. The change removes the device-linking configuration and follows FlashMLA’s whole-program compilation model. The stated intent is to avoid ptxas register spills in attention kernels. No API changes are shown. Verify that the target builds and runs correctly on supported CUDA architectures.QA Engineer Review
No test changes.
Per-File QA Perspective
cpp/tensorrt_llm/flash_mla/CMakeLists.txt: Verify that the extension builds and its attention kernels run correctly with relocatable device code disabled. No test files or test lists changed.