[Perf][SM120][MLA] Use compact FP8 KV rows for NoPE models #58305
Claude Code Review
This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.
This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @lucifer1004.
The pinned FlashInfer 0.7.0.post1 still requires 656-byte rows for GLM53_NOPE. Its decode binding rejects a 528-byte row, so this would break NoPE decode on the pinned dependency. The FlashInfer update containing compact-row support needs to land before this is enabled.
This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @lucifer1004.
The dependency blocker I raised here is resolved by #60948. The pinned FlashInfer 0.7.1 supports compact 528-byte GLM53_NOPE rows, so my earlier comment no longer blocks this change.
This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @lucifer1004.
Approved these changes.
Thanks for the fix. Let's fix the pre-commit and trigger the CI
Hi @lucifer1004, the pre-commit checks have failed. Please run:
``bash `
uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files
Then, commit the changes and push to your branch.
For future commits, pre-commit` will run automatically on changed files before each commit.
/ci run
✅ Triggered Buildkite CI #97491 for commit 8cf7913246e8.
/ci retry
✅ Queued 5 failed job(s) for retry in Buildkite CI #97491.
/ci run
✅ Triggered Buildkite CI #97726 for commit d76d076968d2.
/ci retry
✅ Queued 1 failed job(s) for retry in Buildkite CI #97726.
zyongye
lucifer1004
Purpose
Follow-up to merged #55277: use compact 528-byte
fp8_ds_mlarows for native NoPE on the FlashInfer SM120 backend. Rebased onto upstream maine6674262f1. Only tests conflicted: #55528 made the MLA KV-spec test's fake layer carryattn_backend, and the HiSparse test helper gainedmax_union_rows; both were resolved by keeping both sides. The two commits are nowaab1e922faande879b2ef44(head), and the branch merges cleanly into current main.The row contains 512 FP8 latent bytes and four FP32 group scales. There is no RoPE payload. A single backend-owned row-size method supplies both the KV spec and early HiSparse registration. On SM120, compact selection depends solely on
kv_lora_rank=512andqk_rope_head_dim=0, independent of model name, connector, or offloading configuration. Other backend layouts are unchanged; real RoPE64fp8_ds_mlaretains 656-byte rows. No new dtype or CLI option is added.The writer accepts NoPE 528/656, preserves legacy zero-tail behavior for 656, and rejects RoPE64 with 528. It distinguishes logical row width from physical stride. The fixed 576-dimensional gather rejects compact input. HiSparse uses actual row widths for byte movement and rejects incompatible shared-staging layouts.
No connector changes, layout negotiation, or old-cache migration are added. Local prefix caching remains supported. External connectors were not tested end to end.
Duplicate-work check: #53969/#55778/#55543 use padded compatibility layouts; #55219/#57169 address broader paging/stride plumbing, not this compact writer/spec change. The community B12X GLM_NEXT path already uses the same 528-byte encoding; that is a useful precedent, not the FlashInfer backend wiring implemented here. Reference: local-inference-lab/vllm
cff8aebfeb73de96c97b4c5a0550c5a49f27451c,b12x_mla_sparse.py. FlashInfer compact-row support was merged in flashinfer-ai/flashinfer#5075.Test Plan
Validation used 4x RTX PRO 6000 Blackwell for official NVIDIA GLM-5.3-Flash-NVFP4, TP4, BF16, no speculation, text-only, context 65536, max sequences 32, batched tokens 4096, FULL_AND_PIECEWISE graphs. FlashInfer source:
dc04f50c9aa3eabcdaa5feb0934edb3d85e9529a.Commands below are shown without local environment wrappers, not as verbatim execution transcripts. Paths are relative to the vLLM checkout unless noted. The following checks were rerun after the rebase onto main:
Earlier validation from the FlashInfer checkout, not rerun after the rebase:
Model validation preceded gate removal and was not rerun after the rebase. It used GSM8K and random-8k1k workloads with
FLASHINFER_MLA_SPARSE_SM120explicitly selected. As in #55277, successful runs used the disclosed distributed-autotune workaround:This PR does not fix that separate autotune issue or the noncanonical-layout calibration restriction. FlashInfer 0.6.18.post1, pinned in upstream vLLM, is not the dependency used for this validation.
Test Result
Revalidation after the rebase onto
e6674262f1(heade879b2ef44)Run on 4x RTX PRO 6000 Blackwell with FlashInfer built from main (includes flashinfer-ai/flashinfer#5075) and vLLM's CUDA extension rebuilt from a tree containing this branch:
test_cache.py -k concat_and_cache_ds_mla): 9 passed, 3 skipped. Fixed-layout gather (test_cp_gather_fp8.py): 18 passed. KV-spec tests (test_mla_backends.py -k kv_cache_spec): 10 passed.tests/v1/attention/test_sparse_mla_backends.py: 119 passed, 7 failed. All 7 fail identically one6674262f1without this PR:test_sparse_backend_prefill_correctness[-auto-masked_mha]for deepseek_hd192_v128, glm5_hd256_v256 and glm53_flash_nope_hd256_v256, andtest_hisparse_speculative_rows_resolve_host_misses_consistently[long_mtp].--kv-cache-dtype fp8, default FlashInfer autotune (no skip-ops workaround). GSM8K through the chat template (1,319 problems, flexible-extract, concurrency 32):| | Without this PR (656-byte rows) | With this PR (528-byte rows) |
|---|---:|---:|
| Engine-reported KV tokens | 3,234,669 | 3,972,729 (+22.8%) |
| GSM8K (chat, flexible-extract) | 0.973 | 0.972 |
Both evaluations ran on the same integration tree with unrelated changes for other models; one run each.
Earlier results (before this rebase)
At head
bea90f7efee:prekhooks passed across all 10 changed files, including Ruff, formatting, and mypy.Earlier validation, not rerun after the rebase:
test_mla_backends.pyattempt stopped after 53 passes at an SM100 CUTLASS-only operator unavailable in this SM90/SM120 build. The complete cross-architecture suite was not qualified.KV-cache capacity
Compared with #55277 on the same hardware and serving configuration:
| Metric | #55277 | Compact |
|---|---:|---:|
| Encoded bytes per KV row | 656 | 528 (−19.51%) |
| Engine-reported KV token capacity | 4,301,231 | 5,282,546 (+22.81%) |
| Available KV-cache memory | 40.57 GiB | 40.57 GiB |
The benefit is more KV capacity within the same memory budget, not a throughput claim or a 19.51% reduction in total GPU allocation. Capacity is engine-reported, not saturation-tested; the validation runs used dirty source trees with differing build metadata.
Developed with AI assistance. Opened as a draft pending human line-by-line review; automated validation is not represented as human review. No changes were pushed to #55277.
---
<details>
<summary> Essential Elements of an Effective PR Description Checklist </summary>
supported_models.mdandexamplesfor a new model.</details>