Repository navigation
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
cba4e26 to
57087f7
Compare
|
Rebased onto current main and resolved the |
57087f7 to
42c5b5d
Compare
|
e2e test results? |
|
@lishunyang12 No e2e from my side: the reproducer from #59970 needs an SM103 part and I have no compatible GPU here, and the CI lanes I can see do not build these DSV4.1 builders. What I ran is the scheduler-level parametrization in tests/v1/worker/test_attn_utils.py (82 passed on CPU), which pins per backend and num_speculative_tokens that support now resolves to UNIFORM_BATCH and that decode widths up to 1 + num_speculative_tokens stay graph-eligible. The cleanest e2e confirmation would come from whoever has the B300 repro in #59970: serve DSV4.1 with cudagraph_mode=FULL_AND_PIECEWISE and adaptive verification on, then drive mixed batches at concurrency; before this change it dies with the IMA within about a minute, after it prefill should fall back to the piecewise path that the verification-off arm already runs stably. If a maintainer can point a GPU lane at this PR I am happy to write a small serve-and-probe script for it. |
42c5b5d to
86579a1
Compare
|
Rebased onto current main (the conflict notice went away with it) and reran the pin suite: 82 passed in On e2e: I don't have DSV4.1 hardware here, so nothing beyond CPU-level tests ran on my side. What the unit tests pin is the failure mode itself: all five builders now declare |
86579a1 to
cba4e26
Compare
|
Rebased onto current main; no semantic conflicts. The attention-utils suite passes locally on this head (91 passed, CPU). |
cba4e26 to
015333c
Compare
Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Co-authored-by: Kimi Code <kimi-code@moonshot.cn>
015333c to
d29af51
Compare
|
Hi @he-yufeng! Thank you for submitting this. I can test it e2e. I got here after investigating #62417 and the proposed solution #62535. I think this PR is the right fix. Edit: Can you add "Fixes #62417"? |
| ids=["flashmla", "flashinfer_mla", "swa_flashinfer", "swa_flashmla", "compressor"], | ||
| ) | ||
| @pytest.mark.parametrize("num_speculative_tokens", [0, 7]) | ||
| def test_dsv41_sparse_builders_keep_varlen_decode_graphs_only( |
There was a problem hiding this comment.
Instead of introducing a new test, please parametrize the existing one test_flashinfer_sparse_full_graphs_exclude_prefill_keep_varlen_decode()
| ) -> int | None: | ||
| # Decode replays use device request boundaries; prefill metadata is | ||
| # not graph-safe. | ||
| return max_decode_query_len(vllm_config) |
There was a problem hiding this comment.
One idea to deduplicate code is to introduce a mixin class and reuse it across builders. This mixin could live in vllm/vllm/v1/attention/backend.py.
class VarlenDecodeCGMixin:
_cudagraph_support: ClassVar[AttentionCGSupport] = AttentionCGSupport.UNIFORM_BATCH
@classmethod
def get_varlen_cudagraph_max_query_len(
cls,
vllm_config: VllmConfig,
kv_cache_spec: KVCacheSpec,
) -> int | None:
# Decode replays use device request boundaries; prefill metadata is
# not graph-safe.
return max_decode_query_len(vllm_config)The attribute _cudagraph_support can alternatively be left out of the mixin, then each builder class would define it separately. But setting UNIFORM_BATCH seems like a recurring pattern.
Reuse:
class DeepseekV4FlashInferSparseMLAMetadataBuilder(
VarlenDecodeCGMixin, DeepseekV4SparseMLAMetadataBuilder):
...|
I ran
|
|
@mgoin This PR implements the same pattern we needed in "AV for Mamba2" #53036 (review) |
|
Cross-arch confirmation from the SM120 leg — clean on the vLLM 0.32.0 tree + FlashInfer 0.7.2 (RTX PRO 6000D 84G x8, TP8+EP8, Setup: stock v0.32.0 wheel + a mechanical port of this PR's head d29af51 to the five builder sites (
Also notable for #62417: the chat/thinking corruption we had previously tracked as a kernel-level numeric issue (flashinfer-ai/flashinfer#6812) does not reproduce with this PR on SM120 — the FULL-graph admission of prefill-bearing batches looks like the actual root cause of that symptom as well. (SM120 note: this arch additionally needs the SM120 block-size declaration from #60762 to boot at all — independent axis, both are required here.) Closing #62535 in favor of this PR. Thanks @tomasruizt for the e2e run and the pointer. |
|
Linking for the tracker: #62417 (SM120/RTX PRO 6000D leg of the same failure class — DSpark adaptive verification + FULL graph, corruption symptoms) is also fixed by this PR — confirmed by both arch legs now (2xB300 above, SM120 in our comment). Adding |
|
@tomasruizt @xzwgit Thanks for running both arch legs — the B300 GSM8K table and the SM120 FlashInfer confirmation are exactly the coverage I could not get locally. Added |
|
/ci run |
|
✅ @he-yufeng, CI is now available for this PR.
|
|
✅ Triggered Buildkite CI #97512 for commit ℹ️ This PR is 489 commits behind upstream |
…vllm-project#59986) Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Co-authored-by: Kimi Code <kimi-code@moonshot.cn> Co-authored-by: vllm-agent <claw@inferact.ai> Signed-off-by: Christopher Mackenzie <christopher.mackenzie.software@gmail.com>
[A100][Backport] Keep sparse prefill out of FULL CUDA graphs (vllm-project#59986)
…vllm-project#59986) Signed-off-by: Yufeng He <40085740+he-yufeng@users.noreply.github.com> Co-authored-by: Kimi Code <kimi-code@moonshot.cn> Co-authored-by: vllm-agent <claw@inferact.ai> (cherry picked from commit 8977b13)
Overview
Fixes #59970. Fixes #62417. The five DSV4.1-specific sparse metadata builders declare
AttentionCGSupport.ALWAYS, so withcudagraph_mode=FULL_AND_PIECEWISEprefill and mixed batches get FULL-graph captured even though their prefill metadata is not graph-safe, and the engine dies with an illegal memory access once adaptive verification runs mixed batches at concurrency. Downgrade them toUNIFORM_BATCHand report the speculation width as the varlen decode bound, mirroring the reviewed pattern from #59751.Claims
DeepseekV4FlashMLAMetadataBuilder,DeepseekV4FlashInferSparseMLAMetadataBuilder,DeepseekSparseSWAFlashInferMetadataBuilder,DeepseekSparseSWAFlashMLAMetadataBuilder,CompressorMetadataBuilder.FlashMLAMegaAttnBackendinherits the same builder, so it is covered too.Validation
82 passed on CPU. The 10 new parametrized cases pin, per backend and num_speculative_tokens in {0, 7}, that support resolves to
UNIFORM_BATCH, that decode widths up to the speculation width stay graph-eligible, and that one token wider is rejected with the reported bound. Changed-file pre-commit (ruff-check, ruff-format) passed.Not run: the B300 (SM103) end-to-end reproducer from the issue, no compatible hardware available here, and CI does not exercise these builders. The change only narrows what FULL graphs capture: prefill moves to the piecewise path that the issue's adaptive-verification-off and FULL_DECODE_ONLY arms already exercise for 30+ minutes under load, so no batch that was not captured before becomes captured.
Details
Root cause, from the issue's arm table: adaptive verification on + FULL_AND_PIECEWISE hits the IMA 4/4 within a minute; verification off in the same mode is stable; verification on with FULL_DECODE_ONLY is stable. The failing ingredient is prefill inside FULL graphs. Each affected builder now also overrides
get_varlen_cudagraph_max_query_lento returnmax_decode_query_len(vllm_config)(1 + num_speculative_tokens on MRV2), the same width the V2 runner uses when it builds varlen decode replays.Not a duplicate of #59751: that PR changes only the generic
FlashInferMLASparseTRTLLMMetadataBuilderfor #59681, while the DSV4.1 model wires its own five builders, which the #59970 reporter calls out explicitly. Checked the issue thread and open PRs referencing #59970 before starting; nothing else covers them.AI assistance: Kimi Code (Kimi K3) prepared the patch and tests; I reviewed every changed line and ran the validation above.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.