Repository navigation
Conversation
5 of 20 tasks
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
The FlashInfer MLA decode kernels (sparse trtllm-gen/cute-dsl, dense MLA, DSV4/DSV4.1 sparse) took their scratch from module-global tensors created lazily with torch.zeros. Those buffers live outside the WorkspaceManager, so they stay resident while the engine sleeps (vllm-project#59055; 394 MiB per GPU on GLM-5.3) and are additive to the shared scratch while awake. Request the workspace from the WorkspaceManager instead: reserve it once at construction (or in the dummy run for DSV4, like the FlashMLA DSV4 path) and re-request it on every call. The DCP sizing and the env override are kept; the sparse module tracks the largest requested size so the DCP builder can still raise it before the first capture. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: aoshen02 <aoshen@inferact.ai>
test_dsv41_flashinfer_dspark_window_matches_reference calls DeepseekV4FlashInferMLAAttention._forward directly. The FlashInfer DSV4 workspace now comes from the WorkspaceManager, so the test installs one, as the decode autotune test does. Signed-off-by: aoshen02 <aoshen@inferact.ai> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aoshen02
force-pushed
the
mla-workspace-manager
branch
from
October 4, 2026 18:31
919140b to
d949986
Compare
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
2 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Move the FlashInfer MLA decode workspaces (sparse trtllm-gen/cute-dsl, dense MLA, DSV4/DSV4.1 sparse) from module-global
torch.zerostensors intoWorkspaceManagerscratch. Part of #59055; with #59156 the memory is then released by/sleep.Claims
flashmla_sparse.py,prefill/trtllm_ragged.py)._required_workspace_bytes) andVLLM_FLASHINFER_WORKSPACE_BUFFER_SIZEoverride are unchanged.Validation
mla/_core.py,data/csrc/trtllm_fmha_kernel_launcher.cu,cute_dsl/attention/{mla_decode.py,monolithic/mla_decode.py}); 0.7.0.post1 (the pinned version) differs from 0.7.0 only inaot.py,jit/gemm/core.pyand tests. On every decode path these backends use, the workspace holds only per-launch scratch (trtllm-gen: softmax-stats slab + split-KV scratch, semaphores live in the separatemulti_ctas_kv_counter_buffer; cute-dsl: split-KVacc_o/acc_lsepartials consumed by the reduction kernel of the same call; SM120 sparse:mid_out/mid_lsepartials), so no content survives between calls and no zero-init is needed. The prefill backends already hand trtllm-gen an uninitializedWorkspaceManagerview.WorkspaceManagerview is an input/output of these decode kernels on the paths read (inputs come from the persistenttopk_indices_buffer, the index group, Triton converters,_mtp_hidden_buffer).tests/v1/attention/test_flashinfer_sparse_mla_workspace.py,test_sparse_mla_backends.py,test_flashinfer_mla_dcp.py,test_dspark_noncausal_sparse_mla.py,tests/kernels/attention/test_flashinfer_mla_decode.py: 164 passed, 671 skipped (SM100-only), 18 failed; the 18 failures are identical on unmodifiedmainin that environment (16 ×cp_gather_and_upconvert_fp8_kv_cachesignature mismatch of the local_Cbuild in FlashMLA tests, 1 × FlashInfer 0.6.12 SM90 JIT build failure, 1 ×test_index_group_convert_during_piecewise_capture).pre-commit(ruff, ruff format, mypy, etc.) passes on the commit.--enable-sleep-modeon 4× GB300, same image and node, on top of [Feature] Release WorkspaceManager scratch on sleep #59156 + [Feature] Offload KV-init runtime state on sleep #59158 + [Core] Release the FlashInfer allreduce workspace (MNNVL or TRT-LLM) with --enable-nccl-comm-suspend #59360 (so theworkspacetag is released on sleep):/sleep(nvidia-smi): 5945 MiB without this PR, 5551 MiB with it (-394 MiB, exactly the sparse-MLA workspace). Torch-allocated memory drops by 352 MiB while awake (263465 to 263113 MiB per worker) because the workspace now fits inside the existing 1520 MiBworkspaceslot; KV cache grows by 42 MiB.Workspace is lockederrors.flashinfer_mla.pypath and the DSV4/DSV4.1 FlashInfer paths on a real model (V4-Flash in this image uses FlashMLA; forcingFLASHINFER_MLA_SPARSE_DSV4rejects its packed KV layout).Details
flashinfer_mla_sparse.py:_get_workspace_buffer()now requests((bytes,), int8)from the manager; a module-level int keeps the largest size requested so the DCP builder can still raise it in its__init__, before the first forward/capture.FlashInferMLASparseImpland the SM120 impl reserve in__init__and re-request in_run_mqa_kernel;_prepare_mqa_kernelloses itsdeviceargument.flashinfer_mla.py: same, sized byneed_to_return_lse_for_decode(known at construction).deepseek_v4(1)/nvidia/flashinfer_sparse.py:_get_flashinfer_dsv4_workspace()requests((128 MiB,), uint8); the SM100 class reserves it in the dummy run (like the FlashMLA DSV4 path), the SM120 class already did via_reserve_empty_forward_workspace.(ubatch, lane)slot that runs these kernels grows to at least the workspace size; with DBO that is ×2, as for every other scratch user.impl._workspace_bufferdirectly now monkeypatch_get_workspace_buffer; the autotune test installs aWorkspaceManager.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.
AI assistance: written with Claude Code (Claude Fable 5.1), reviewed and tested by the human submitter.
Re-check on current main (
bdd31c31d), GB300 (rebased; adds a WorkspaceManager to the SM100-only DSV4.1 dspark test, which this change otherwise breaks)Re-checked on main bdd31c3 (rebased; only an import-line conflict in
test_sparse_mla_backends.py), 4x GB300 (SM103, so the SM100-only tests run),
FlashInfer 0.7.0.post1:
cases) called DeepseekV4FlashInferMLAAttention._forward without a WorkspaceManager
and failed with this PR; fixed in the test, which now installs one (as the autotune
test does). test_dspark_noncausal_sparse_mla.py + test_flashinfer_sparse_mla_workspace.py
backend still rejects its packed KV), so it does not exercise this change: as a
regression check, asleep memory, wake time and outputs (3 cycles, 28/28 greedy and
28/28 seeded) are unchanged. The GLM-5.3-Flash numbers above were not re-measured.
🤖 Generated with Claude Code