Conversation
…infer-ai#2888 Ports PR flashinfer-ai#2888's non-alpha SM103 epilogue tiling and accumulator-overlap optimizations.
Reconstructs N-major C with the divisibility and alignment metadata required for 256-bit non-TMA stores.
Uses the supported register-to-global copy operation in the SM103 alpha epilogue.
Enumerates both kernels locally and requires CUPTI CUDA-Graph cold-L2 timing.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Description
In Issue #2621 and its related PR #2888, changes from the upstream CUTLASS CuTe DSL SM103 mm_fp4 kernel were ported to flashinfer. However, the ported SM103 mm_fp4 kernel underperformed the SM100 kernel across all shapes when both were run on a B300. This PR does the following to fix performance:
This carries over the SM103 kernel changes from PR#2888 excluding the alpha scaling sections which are dealt with below.
The PR#2888 alpha epilogue unnecessarily cast the FP32 accumulator to BF16 before scaling, promoted it back to FP32 for multiplication, then cast it to BF16 again.
This extra type conversion was fixed by PR #4526, which added dedicated TMA and non-TMA helpers in
epilogue_utils.pythat apply alpha directly to the FP32 accumulator before a single conversion to the output dtype.This PR makes a small edit to
epilogue_utils.pyby replacingcute.nvgpu.CopyStgOp()with the supported explicit register-to-global operationcute.nvgpu.CopyR2GOp(). The CopyStgOp does not appear to be exposed by the supported CuTe DSL wheels.Upstream CUTLASS gives CuTe explicit compile-time guarantees that C is compact N-major, N is divisible by 64 and its pointer is 32-byte aligned. FlashInfer’s TVM-FFI wrapper rebuilt C as a generic tensor and discarded those guarantees, so CuTe could prove only 16-bit BF16 stores were safe.
This PR reconstructs the same layout, divisibility and alignment contract, guarded by
can_implement(), allowing the intended 256-bit vectorized stores.Performance
SM103 now wins five of the six largest shapes, with up to 14.8% higher throughput. Measured on an NVIDIA B300 SXM6 using independently exhaustive tactic selection, CUPTI CUDA-Graph timing and cold-L2 conditions.
🔍 Related Issues
🚀 Pull Request Checklist
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).tests/gemm/test_mm_fp4_sm103.pyandtests/gemm/test_mm_fp4.pyon a B300.Reviewer Notes