Repository navigation
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
@mmangkad, could you take a look when you have a chance? This is a one-file, test-only follow-up from our SM120 validation work. It makes the existing DSV4 C4/C128 test honor the production dense fallback when sparse prefill is requested, so upcoming SM120 kernel and dispatch changes can use it as a real quality gate. The targeted registered test passes on RTX PRO 6000 Blackwell. If it looks right, could you enable CI? |
…device actually has Boot 11 failed on both architectures of this rig for two different reasons, and neither was a missing capability -- both were a dispatch that named one architecture where it meant "has this kernel". TP0 (5090, sm120) entered the sparse-prefill branch and hit "Sparse Attention Forward Kernel is only supported on SM90a and SM100f". Upstream already fixed exactly this in the merged PR sgl-project#30272 by adding "and not _is_sm120" to the predicate; our base predates it (git log -S on that file is empty, so this is an old base, not a fork regression). Adopted rather than rebuilt, but phrased as flash_mla_sparse_fwd_supported(device) -- the kernel states its own domain in its error text, so the gate says major in (9, 10) and covers Ampere with the same line. The dense branch it falls to is handed the SAME swa_page_indices / swa_topk_lengths the indexer produced: the kernel changes, the attention support does not. Two independent confirmations that this is lossless rather than an approximation: upstream sgl-project#32464 calls the SM120 dense route intended production behaviour, and our own test kit compares both branches against one _pure_torch_dsv4_combined_reference. TP1/TP2 (3080, sm86) died in dsv4/dequant_k_cache.py on "type fp8e4nv not supported in this architecture". The V4 KV layout is fp8-e4m3 BY ARCHITECTURE (448 fp8 nope + 64 bf16 rope + 7 ue8m0 scale bytes in a uint8 pool); --kv-cache-dtype cannot move it, the pool asserts store_dtype == uint8. Triton's NVIDIA backend admits fp8e4nv only from capability 8.9. The briefing named one file. The bug has four call sites, and fixing only the named one would have MOVED the failure rather than removed it -- the two KV *writers* run before any attention: * dequant_k_cache.py (read) -> manual decode * flash_mla_sm120_triton.py -> manual decode; this is the one that actually becomes load-bearing on sm86 once the sparse branch is left * index_buf_accessor.py (write) -> turned out to be a pure byte copy with no arithmetic between load and store, so both ends are viewed as uint8 unconditionally: byte-identical everywhere, no gate needed * quant_k_cache.py (write) -> a real encode. Rather than hand-roll round-to-nearest-even in Triton, the fallback stages the already-clamped float32 and lets torch do the cast, which sgl-project#262 proved bit-exact on sm86. f32 not bf16 staging: bf16 has 8 mantissa bits and would double-round. Third finding, from sgl-project#33194's report and confirmed here: the compile failure is triggered by the kernel ARGUMENT, not the load -- an fp8-typed tensor fails at the def line even if the pointer is never dereferenced. An in-kernel branch alone cannot fix it, so the host passes the uint8 view and a tl.constexpr selects the decode. nope_cache_view returns view and flag together, following sgl-project#192's pairing invariant: a caller cannot take one without the other. Also removed the module-level SGLANG_SM120_FLASHMLA_BACKEND read in flash_mla_sm120.py -- the exact sgl-project#343 anti-pattern, and its default resolves to a flashinfer kernel gated to cc 120/121, so on a mixed group every rank got whichever card imported first. Resolution is per device now; an explicitly set value still applies everywhere (a statement about the launch, not a probe), and is downgraded loudly, not silently, where the kernel cannot exist. TESTS (desk, CUDA_VISIBLE_DEVICES=99, no GPU touched) test_dsv4_fp8_triton_compat_417.py 12 tests / 262 subtests green. Runs the production @triton.jit decode under TRITON_INTERPRET=1 against a pure Python IEEE-754 reference that never touches a torch fp8 dtype (sgl-project#262's rule: a torch reference would share torch's own Ampere bug and pass vacuously), with an e5m2 cross-probe so a comparison of nothing fails. All 256 codes, signed zero at 0x80, both NaN codes, plus the whole paged kernel vs the torch ref. CAN-FAIL: bits & 7 -> bits & 6 gives 128 failed / 10 passed. test_dsv4_arch_dispatch_417.py 16 tests / 28 subtests green, incl. the two cards of this rig disagreeing inside one process. CAN-FAIL: _FLASH_MLA_CUDA_MAJORS -> (8, 9, 10) gives 7 failed / 15 passed. Regression: unit/layers/attention + unit/utils, 44 failed / 362 passed on this branch vs 44 failed / 334 passed at a56f33aafd (throwaway detached worktree). Failing set diff EMPTY; all 44 pre-existing "No CUDA GPUs are available". The +28 are these tests. ruff 1 finding on the touched files, the identical 1 at the base (F841, pre-existing). codespell, black, isort clean. mypy clean on both new modules. NOT proved at the desk, by construction: that these kernels COMPILE on a real sm86 card. The Triton interpreter never invokes the NVIDIA backend, which is where fp8e4nv is rejected. Gates for the card window are written down in docs/dev/PLAN_417_dsv4_arch_paths.md along with the full per-architecture coverage matrix, the upstream survey, and the open risks -- chief among them that the indexer (dsv4/indexer.py:667, DeepGEMM metadata) is NOT addressed here and may well be where boot 12 stops, and that sgl-project#33194's chain ends at FP4 routed experts, a wall we expect to miss because we serve GGUF.
…roduction takes The compact runner pins SGLANG_OPT_FLASHMLA_SPARSE_PREFILL and then asserts sparse_prefill_cache was populated. With the sparse-prefill gate in place that assertion is now false on every device without flash_mla_sparse_fwd -- SM120 and Ampere both -- and it fires BEFORE the output is compared against the pure-torch reference, so a real regression would be hidden behind a known false failure. Upstream PR sgl-project#32464 makes the same fix for SM120 alone; this uses the same predicate as production, so it covers Ampere too. The env override deliberately stays on: production ignores the request on these architectures, and if the production gate were removed this test would go red again rather than quietly following it. The C4 seeding dispatches on the resolved path for the same reason it dispatched on the flag before -- the two must not disagree about which branch is being exercised. Desk: black, isort, codespell, ruff clean on the file (ruff was already clean at the base). unit/layers/attention 44 failed / 362 passed, unchanged failing set. The kit itself needs a GPU and is a card-window item.
806c572 to
e918cab
Compare
|
Updated the code and PR body. The sparse-prefill test uses the SM120 capability guard to seed and assert the expected dense fallback, while keeping the sparse-prefill override enabled so removing the guard is detected. |
e918cab to
f1eb1f5
Compare
… correctness) - core batch [10-15]: sgl-project#43376 long-ctx indexer OOM bound, sgl-project#42368 FlashInfer-0.7 decode dispatch, sgl-project#39914 extra-KV 64-token page split + candidate fallback, sgl-project#42714 graph-safe page-split buffers, sgl-project#32464 SM120 sparse-prefill test gate, sgl-project#34027 int32->int64 page-split overflow guard. - Group C [16-23]: sgl-project#42717 TP-rank verify-budget, sgl-project#43225/sgl-project#43374 compact-verify seq_lens + padding renorm, sgl-project#42718 packed-verify token->request map, sgl-project#42713 forced-uniform capture metadata, sgl-project#45301 padded-query graph lifetime, sgl-project#44141 bounded-replay guard, sgl-project#45185 V4.1-Flash-1017 FP8 QDQ (env-gated, default OFF). sgl-project#42710 skipped (superseded upstream: step_logits already fp32).
|
Thanks @ormandj. Closing this because you have 46 PRs open and none updated in 7 days, over our soft cap of 5 for idle PRs. Reopen the two or three you most want reviewed - a short active set moves faster than a long idle one. Some directories moved recently, so an older branch may need retargeting: |
Motivation
test_compress_attention_cases_sparse_prefillenables sparse prefill and expects_forward_prefill_sparseto populatesparse_prefill_cache. On SM120, production intentionally stays on the denseflash_mla_with_kvcache_sm120path becausesparse_prefill_fwdis not supported. The test therefore fails at the path assertion even though the backend selected the expected implementation.This comes up when running the registered DSV4 attention test directly on an SM120 system, or when trying to add that test to an SM120 runner. No unusual server configuration is required: the test sets the sparse-prefill override itself. Production correctly ignores that request on SM120, but the fixture still seeds metadata for the sparse path and then asserts that its cache was populated. The failure happens before the output is compared with the PyTorch reference.
Modifications
Use
is_sm120_supported()when deciding which path to seed and assert. The sparse-prefill env override is still enabled, so the test will fail if the SM120 guard is removed and sparse prefill becomes eligible.Behavior on non-SM120 systems is unchanged. No serving code is modified.
Accuracy Tests
The targeted registered GPU test has not been rerun.
Speed Tests and Profiling
Not applicable; only test setup and assertions change.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciDeveloped with AI assistance.
CI States
Latest PR Test (Base): ❌ Run #37577729854
Latest PR Test (Extra): ❌ Run #37577729657
Latest PR Test (AMD ROCm 10): ❌ Run #37577729804