Skip to content

[nv_dev] SM120: MQA logits kernels fail test_attention self-consistency (fp8: nondeterministic/race) and accuracy (mxfp4 H=64 D=128) #392

Description

@linjiapro

Summary

On SM120 (nv_dev @ f8e8fb5, deep_gemm 2.6.1), the MQA logits kernels fail the repo's own tests/test_attention.py::test_mqa_logits, in two independent ways:

  1. FP8 format: nondeterministic output (race). The test's self-consistency check — the same kernel on identical input across 20 repeat launches — fails with bitwise-different results:
    AssertionError: bitwise mismatch (mqa logits self-consistency): num_bytes=1048576,
    num_mismatch=56571, first_byte=250, elem=125, coord=(0, 125), byte_in_elem=0,
    x_byte=0, y_byte=134, x_val=0.0, y_val=1.046875
    
  2. MXFP4 format (H=64, D=128): accuracy failure. AssertionError: Diff: 0.6187 vs 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

  • GPU: NVIDIA RTX PRO 6000 Blackwell Max-Q Workstation Edition (SM120), driver 580.126.09
  • CUDA 13.0, nvcc from /usr/local/cuda/bin, host compiler g++-10 (system g++ 9.4 lacks C++20 and fails JIT outright — separate, expected)
  • torch 2.11.0+cu130, Python 3.12
  • deep_gemm 2.6.1 built from nv_dev @ f8e8fb5 via setup.py bdist_wheel (CC=gcc-10 CXX=g++-10)

Repro

python - <<'EOF'
import sys
sys.path.insert(0, '<DeepGEMM>/tests')
import test_attention as ta
# fp8-only: the race repros here; the full sweep fails earlier on mxfp4 accuracy
orig = ta.sample_mqa_cases
ta.sample_mqa_cases = lambda tag, cases: [c for c in orig(tag, cases) if c[0] == 'fp8']
ta.test_mqa_logits()
EOF

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_topk threshold 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's top_k_per_row_prefill converting 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions