Repository navigation
[Bugfix][GLM-5.3-Flash] Keep batch x heads out of gridDim.z in the GLM-5.3-Flash fused recurrent KDA kernel #56974
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
Changes from 2 commits
09d8cde
3a0cf44
3bb5fdc
b281d66
f2c5651
8d96809
99bab4b
b2b249e
3201f0f
1fe2ac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,7 +68,9 @@ def fused_recurrent_kda_fwd( | |
| else: | ||
| stride_indices_seq, stride_indices_tok = ssm_state_indices.stride() | ||
|
|
||
| grid = (NK, NV, N * HV) | ||
| # N * HV goes in gridDim.x: gridDim.z is capped at 65535 and batch x heads exceeds it | ||
| # (e.g. GLM-5.3-Flash at TP=1: 1024 x 64 = 65536 -> "invalid argument" at CUDA-graph capture). | ||
| grid = (N * HV, NV, NK) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Do we see this error only for GLM-5.3-Flash or for all models using KDA?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here, I have encoutered this issue with GLM-5.3-Flash, but did't try or see any other model with this issue
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have reproduced the end-to-end failure only with GLM-5.3-Flash, in the DP configuration we tested (TP=1 per rank, default Direct kernel tests on the 2026-09-11 nightly (synthetic inputs, one GB200, wrappers called directly): the stock Whether another model exposes the issue depends on which kernel its dispatch path reaches and on the sequence and head counts of those calls. From code reading only (not tested): the Qwen GDN layer sends uniform non-spec decode batches to Happy to retitle the PR to say "shared KDA/GDN fused recurrent kernels" with GLM-5.3-Flash as the verified reproducer, if you prefer.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One option is to do one of the following:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Went with option 2. The PR is now limited to the NVIDIA GLM-5.3-Flash copy: Re-ran the kernel regression test on the 2026-09-11 nightly image (4× GB200) with only the two NVIDIA GLM kernel files copied over the installed package (the shared flash-linear-attention wrappers left as installed): stock 2 failed / 6 passed in Done as an additional commit rather than a rewrite so the review history stays intact. PR title and description updated accordingly.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am happy to try this PR on AMD MI350 so we can keep the rocm code. Just LMK once it's re-added, thanks. Or if you rather have this merged ASAP I can open an AMD version of the PR |
||
| fused_recurrent_gated_delta_rule_fwd_kernel[grid]( | ||
| q=q, | ||
| k=k, | ||
|
|
||
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.
Could we don't change these unrelated files
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.
Reverted in the latest commit — the PR now only touches the GLM-5.3-Flash NVIDIA copy under
models/glm5next/nvidia/opsand its test. Details in the thread above.