-
Notifications
You must be signed in to change notification settings - Fork 1.1k
SM120: fix FP8 MQA logits swizzle mode for head_dim < 128 #379
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
base: nv_dev
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -116,8 +116,12 @@ def enumerate_mqa_logits(): | |
| for seq_len, seq_len_kv, head_cfgs in ( | ||
| *[(s, k, [(64, 128)]) for s in (128, 512, 2048, 4096) for k in (4096, 8192)], | ||
| *[(s, k, [(64, 128), (32, 128)]) for s in (510, 512) for k in (130560,)], | ||
| # head_dim < 128 coverage (FP8-only): kernel swizzle must follow head_dim | ||
|
Collaborator
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. 🔵 suggestion: The new head_dim 32/64 coverage is a good regression guard. Since the original bug was nondeterministic across runs, consider confirming the test's reference-comparison tolerance is tight enough to reliably fail on the pre-fix ~0.98 diff, and ideally exercise a deep KV pipeline (large seq_len_kv) where the mis-addressing manifested. A single tight comparison should catch it, but making the deterministic-across-runs aspect explicit would strengthen the guard. 🤖 v3 |
||
| (512, 8192, [(64, 64), (64, 32)]), | ||
| ): | ||
| for num_heads, head_dim in head_cfgs: | ||
| if is_fp4 and head_dim != 128: | ||
| continue | ||
| for disable_cp in (False, True): | ||
| yield is_fp4, logits_dtype, compressed_logits, clean_logits, seq_len, seq_len_kv, num_heads, head_dim, disable_cp | ||
|
|
||
|
|
||
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.
🔴 critical: The Q/KV SMEM is written in the swizzle chosen by the TMA descriptor (swizzle_mode=head_dim: 32B/64B/128B) but the read SwizzleContext uses a constant kSwizzleMode=128 (B128). For head_dim 32/64 the read layout and the written layout differ, mis-addressing reads into other already-written pipeline stages => wrong + nondeterministic logits. Set kSwizzleMode=kHeadDim so the read layout matches the descriptor (B32/B64/B128). The paged kernel needs the very same change.
🤖 v4