Conversation
`torch.equal` fails for all three cut points on torch 2.11.0+cu130 / flashinfer 0.6.18 / triton 3.6.0 (sm_89): cuBLAS picks a different kernel for M=5000 and M=5000-cut, so the indexer's q and k round differently, a few rows flip one block at the top-k margin, and the layer output differs by up to 2.6e-3 (a few bf16 ulps). Both paths are deterministic run to run. Use the tolerance of the neighbouring oracle tests. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0173pf9k9fSVtwbm3f898HDt
|
Re-tested against current main ( Method. This PR's head merged onto main, then the full Result: 1205 passed, 350 skipped, no new failures. 🤖 Generated with Claude Code |
|
Closing this. It was written with heavy AI assistance, and the maintainers have indicated that do not want such contributions. The description and the diff stay here for anyone who wants to pick the idea up. |
What
test_chunked_prefill_matches_one_shotassertstorch.equalbetween the chunked and the one-shot prefill output of the QSA layer. On torch 2.11.0+cu130 / flashinfer 0.6.18 / triton 3.6.0 (RTX 6000 Ada, sm_89) all three cut points fail onmain(af71ba4), by a few bf16 ulps. This compares at the tolerance the neighbouring oracle tests in the same file already use (rtol=2e-2, atol=2e-2) and says why in the docstring.Why this is the test's contract and not a chunked-prefill bug
Measured on plain
mainwith the test's own fixture, seed and cut points:qkv_projover the same rows gives different bf16 results for M=5000 and M=904 (max diff 3.9e-3, one ulp at that magnitude); the indexer's q and k differ for every cut. cuBLAS picks its kernel per shape, which a chunked prefill cannot avoid.qkv_projmax diff, M=5000 vs M=rowsThe bf16 defaults of
assert_close(atol 1e-5) also fail, on elements near 1e-6, so the explicit tolerance is the one that matches the rest of the file.Testing
tests/models/qwen4_exp/test_qsa_backend.pyon the stack above: 9 passed (was 3 failed, 6 passed).🤖 Generated with Claude Code
https://claude.ai/code/session_0173pf9k9fSVtwbm3f898HDt