Repository navigation
perf(dsa): cuDNN + FlashMLA kernels for GLM-5 sparse attention (model.dsa_backend) #3829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+266
−49
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
91874c3
perf(kernels): use cuDNN CuTe-DSL DSA kernel for sparse MLA backward …
samsja 30cd8c9
chore: drop sparse MLA microbenchmark script
samsja 528f731
feat(config): model.sparse_mla_backward to choose the DSA backward ke…
samsja f4f1076
feat(trainer): model.dsa_backend with a FlashMLA forward + cuDNN back…
samsja 1b935b6
examples(glm-5.3): SFT on cudnn_flashmla DSA backend, add 12-node 16k…
samsja f2372e9
refactor(trainer): dsa_backend is tilelang (TileLang fwd+bwd) or cudn…
samsja 8b5e3b6
perf(trainer): cuDNN frontend FP8 indexer scoring + radix top-k under…
samsja 513ccfc
docs(glm-5.3): note the cuDNN indexer on cudnn_flashmla; comment top-…
samsja 0388753
Revert "docs(glm-5.3): note the cuDNN indexer on cudnn_flashmla; comm…
samsja fb5da5b
Revert "perf(trainer): cuDNN frontend FP8 indexer scoring + radix top…
samsja 0894aa8
refactor(dsa): DSABackend Literal, required backend arg, if/else disp…
samsja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # 12-node, 16k-token overlay: enough GPUs that the model state fits without CP or offloading, | ||
| # so each GPU runs one 16k sequence per micro-batch and blocks compile with fullgraph. | ||
| # Compose after the data overlay, e.g. base.toml @ math-10k.toml @ 16k-12-node.toml. | ||
|
|
||
| [model] | ||
| cp = 1 | ||
| optim_cpu_offload = false | ||
| ac_offloading = "None" | ||
|
|
||
| [model.compile] | ||
| fullgraph = true | ||
|
|
||
| [data] | ||
| seq_len = 16384 | ||
| batch_size = 96 | ||
| micro_batch_size = 1 | ||
|
|
||
| [deployment] | ||
| num_train_nodes = 12 |
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None arch selects SM100 backward
Medium Severity
cudnn_flashmlabackward now passescudnn_backward_arch()straight intocudnn_sparse_mla_backward. That helper returnsNonefor a non-single KV head or an unsupported GPU, and the callee treats every non-sm90value as SM100, so the wrong kernel runs instead of failing closed.Additional Locations (1)
src/prime_rl/trainer/models/kernels/sparse_mla_bwd.py#L361-L371Reviewed by Cursor Bugbot for commit cb55aa6. Configure here.