mirror of
https://github.com/deepseek-ai/DeepGEMM.git
synced 2026-11-05 00:47:26 +00:00
[GH-ISSUE #392] [nv_dev] SM120: MQA logits kernels fail test_attention self-consistency (fp8: nondeterministic/race) and accuracy (mxfp4 H=64 D=128) #181
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/DeepGEMM#181
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @linjiapro on GitHub (Jul 26, 2026).
Original GitHub issue: https://github.com/deepseek-ai/DeepGEMM/issues/392
Summary
On SM120 (
nv_dev@f8e8fb5, deep_gemm 2.6.1), the MQA logits kernels fail the repo's owntests/test_attention.py::test_mqa_logits, in two independent ways:H=64, D=128): accuracy failure.AssertionError: Diff: 0.6187vs the 0.02 tolerance, at full throughput (~776 TFLOPS on this part) — wrong numbers, not a launch failure.This kernel family has needed per-arch synchronization fixes before — SM90 (#229), SM100 (#285, and
96fbced"Fix SM100 FP16 MQA synchronization") — and SM120 appears to be missing its equivalent.Environment
/usr/local/cuda/bin, host compiler g++-10 (system g++ 9.4 lacks C++20 and fails JIT outright — separate, expected)nv_dev@f8e8fb5viasetup.py bdist_wheel(CC=gcc-10 CXX=g++-10)Repro
Fails within minutes on the hardware above. The unfiltered
test_mqa_logits()fails earlier, on the mxfp4 accuracy assert.Real-world impact
This is the root cause of DeepSeek-V4-Flash being unusable on SM120 workstations via vLLM (vllm-project/vllm#49896 has the full serving-side evidence chain): the indexer's prefill logits come out NaN-dominated (83% NaN on the first C4A layer, cascading to 100%), so sparse top-k selection is effectively random for prompts past ~2048 tokens — outputs are coherent below the
index_topkthreshold and unrelated hallucination above it. The NaN fractions differ across TP ranks on identical input, consistent with the race shown by the self-consistency failure. (A secondary effect — vLLM'stop_k_per_row_prefillconverting the NaN scores into out-of-bounds indices and crashing the engine — is being handled on the vLLM side: vllm-project/vllm#49897.)Happy to run diagnostics or test candidate fixes on this hardware — SM120 workstation parts seem hard to come by in CI, and the JIT-based build makes candidate patches quick to iterate here.
@linjiapro commented on GitHub (Jul 26, 2026):
Deeper isolation results that sharpen (and partly correct) the original report — same hardware, nv_dev @
f8e8fb5standalone:The fp8 kernel's valid-region output is correct and deterministic. Probing
fp8_fp4_mqa_logitsdirectly (30 repeat launches per config, causal and CP-staggered[ks,ke)windows, shapes up to 4096×8192, H=64 D=128): zero mismatches and zero NaN within each row's[ks_i, ke_i)window, across every config tested.The self-consistency test failure is caused by nondeterministic out-of-window writes. In compressed mode the kernel writes into output cells beyond each row's valid width — up to ~100M cell-mismatches summed over 30 reps in an S=4096 sweep, varying run to run, while valid cells stay bit-identical. In the uncompressed+
clean_logitsconfig, those same stray writes race thesmxx_clean_logitspass over the invalid cells, which is exactly whatassert_bitwise_equalcatches (e.g.x_val=0.0, y_val=1.046875). So the fix target is the store path (bound stores to the row's window / don't emit fire-and-forget stores outside it), not the compute pipeline.The mxfp4 H=64 D=128 accuracy failure (
Diff: 0.6187) stands as reported.For context on the serving-side NaN we originally attributed here (vllm-project/vllm#49896): further instrumentation shows the MQA kernel's inputs were already NaN (produced earlier in vLLM's DSv4 stack), so that symptom was not this kernel's fault. Separately, vLLM's vendored copy of this tree (a ~2.5.0 nv_dev snapshot) still contains the paged-kernel prefetch bug fixed on nv_dev by the "Use the scheduler's actual next task: zero-context atoms can be skipped" change in
sm120_fp8_paged_mqa_logits.cuh— worth flagging to anyone vendoring.Happy to iterate on a bounded-store fix for (2) here — the JIT build makes candidate patches quick to verify on SM120.
@linjiapro commented on GitHub (Jul 26, 2026):
Closing from our side: after deeper isolation (see the update above), none of the defects documented here block our SM120 serving use case — the fp8 kernel's valid-region output is correct and the stray out-of-window stores are invisible to window-respecting consumers, so we won't be driving a fix. The evidence stands as documented (the stray stores are why test_attention's self-consistency assert fails on SM120, and the mxfp4 H=64 D=128 accuracy failure is real for anyone on the FP4 indexer path) — please feel free to reopen if you want to track either.