Repository navigation
Add Hopper CuTe DSL DualGEMM SwiGLU kernel - #43835
Closed
WhoisZihan wants to merge 2 commits into
Closed
WhoisZihan wants to merge 2 commits into
WhoisZihan wants to merge 2 commits into
Conversation
Contributor
|
Thanks @WhoisZihan. Closing this because it is still a draft and has not been updated in 24 days. Reopen it if the work is still relevant. Some directories moved recently, so an older branch may need retargeting: |
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.
Motivation
CUTLASS and xFormers already provides DualGEMM for sm80, which fuses the swiglu elementwise computation into the gate/up matrix multiplication. But they need rewriting and tuning on sm90+. Recently there is dualgemm PR #41887 for Blackwell using CuTeDSL, so the pr sticks with cutedsl sm90 dualgemm instead of cutlass in the end.
Modifications
Add an SM90 CuTe DSL kernel that fuses gate/up projections with SwiGLU for BF16 and FP16 decode batches of up to 16 tokens. It uses TMA loads, warp specialization and WGMMA, with two configurations and dispatch calibrated on H100 PCIe.
Includes tests for numerical accuracy, pipeline reuse, input validation, CUDA Graph replay and torch.compile. The kernel is exposed as a standalone operator. Model integration will be added later.
Accuracy Tests
No end-to-end test yet, while the unit tests are available which compares the actual output with reference
Speed Tests and Profiling
Currently there are 2 sets of tactics T1/T2 available with auto dispatch, and I've also tested another two sets of tactics T3/T4, but found them worse than T1/T2, so they are abandoned for now.
BF16/FP16 speedup
Follow Up
More tactics on more Hopper cards
The statistics are run on H100-PCIe(sm90a) with only two sets of tactics, due to limited quota of cards. The percentage might vary a little bit on H100-SXM or H200. I'll consider adding more statistics in the future if possible.
FP8 support
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ❌ Run #38238620915
Latest PR Test (Extra): ❌ Run #38238620755
Latest PR Test (AMD ROCm 10): ❌ Run #38238620864