Skip to content

[Bugfix] Fix TRTLLM ragged MLA prefill workspace warmup - #42112

Merged
MatthewBonanni merged 1 commit into
vllm-project:mainfrom
mmangkad-dev:fix/trtllm-ragged-workspace-warmup
May 14, 2026
Merged

MatthewBonanni merged 1 commit into
vllm-project:mainfrom
mmangkad-dev:fix/trtllm-ragged-workspace-warmup

Conversation

@mmangkad

@mmangkad mmangkad commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Fix TRTLLM_RAGGED MLA prefill failing after CUDA graph capture.

After the MLA prefill backend refactor in #32623, the FlashInfer workspace used by TRTLLM_RAGGED MLA prefill is allocated lazily. The first real request after lock_workspace() could hit:

Workspace is locked but allocation from 'trtllm_ragged.py:66:_get_workspace_buffer' requires 394.00 MB, current size is 0.00 MB. Workspace growth is not allowed after locking.

Eagerly allocate the FlashInfer workspace buffers during MLA prefill backend initialization so they are reserved before lock_workspace().

cc @MatthewBonanni @LucasWilkinson @mgoin

Test Plan

Run the server with TRTLLM_RAGGED MLA prefill on GB300 GPUs:

vllm serve moonshotai/Kimi-K2.6 \
  --trust-remote-code \
  --tensor-parallel-size 4 \
  --attention-config.mla_prefill_backend TRTLLM_RAGGED \
  --tool-call-parser kimi_k2 \
  --enable-auto-tool-choice \
  --reasoning-parser kimi_k2 \
  --speculative-config '{"model": "lightseekorg/kimi-k2.6-eagle3-mla", "method": "eagle3", "num_speculative_tokens": 3}'

Test Result

Before this PR, the command above did not start successfully and failed with the locked workspace assertion.

After this PR, the same command starts successfully and works correctly with TRTLLM_RAGGED MLA prefill.

@mmangkad
mmangkad requested a review from njhill as a code owner May 8, 2026 20:59

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mergify mergify Bot added v1 bug Something isn't working labels May 8, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the _warmup_and_capture logic in gpu_model_runner.py to ensure force_attention is enabled for all captured CUDA graph modes, rather than only for full graphs. This adjustment ensures that attention metadata is built during warmup, preventing forbidden lazy workspace allocations after lock_workspace() is called. I have no feedback to provide as no review comments were submitted.

@mergify

mergify Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Hi @mmangkad, the pre-commit checks have failed. Please run:

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.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@mmangkad

Copy link
Copy Markdown
Contributor Author

@MatthewBonanni @LucasWilkinson could you help take a look at this?

@MatthewBonanni MatthewBonanni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding this bug and contributing this fix! I'd prefer to just eagerly allocate the buffers though, rather than force_attention for PIECEWISE warmups.

#42539

@mmangkad
mmangkad force-pushed the fix/trtllm-ragged-workspace-warmup branch from a7d1245 to 33b1581 Compare May 14, 2026 02:27
@mmangkad
mmangkad requested a review from pavanimajety as a code owner May 14, 2026 02:27
@mergify mergify Bot added the nvidia label May 14, 2026
@github-project-automation github-project-automation Bot moved this to In review in NVIDIA May 14, 2026
@mmangkad

Copy link
Copy Markdown
Contributor Author

@MatthewBonanni updated

@mmangkad
mmangkad force-pushed the fix/trtllm-ragged-workspace-warmup branch from 33b1581 to 52b4a3d Compare May 14, 2026 02:31
Eagerly allocate FlashInfer workspace buffers during MLA prefill backend initialization so they are reserved before workspace locking. This prevents TRTLLM_RAGGED prefill from first allocating its workspace during inference after lock_workspace().

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
@mmangkad
mmangkad force-pushed the fix/trtllm-ragged-workspace-warmup branch from 52b4a3d to 3967b35 Compare May 14, 2026 02:33
@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label May 14, 2026

@MatthewBonanni MatthewBonanni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@github-project-automation github-project-automation Bot moved this from In review to Ready in NVIDIA May 14, 2026
@MatthewBonanni
MatthewBonanni merged commit 2317682 into vllm-project:main May 14, 2026
66 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA May 14, 2026
@mmangkad
mmangkad deleted the fix/trtllm-ragged-workspace-warmup branch May 14, 2026 13:51
mfylcek pushed a commit to mfylcek/vllm that referenced this pull request May 19, 2026
…#42112)

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
h1t35h pushed a commit to h1t35h/vllm that referenced this pull request May 21, 2026
…#42112)

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
Liuweixiong0118 pushed a commit to Liuweixiong0118/vllm that referenced this pull request Jun 1, 2026
…#42112)

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
Signed-off-by: Liuweixiong0118 <lwx34158427@gmail.com>
MingqiWang-coder added a commit to intellistream/vllm-hust-legacy-20260831 that referenced this pull request Jul 2, 2026
Cherry-pick 62 bugfix/security PRs from upstream vllm-project/vllm main
(2026-05-03 to 2026-06-17), covering scheduler, engine core, model runner,
worker, attention, KV cache, compilation, and structured output fixes.

Security (4): vllm-project#43286 vllm-project#44744 vllm-project#45118 vllm-project#45252
Bugfix (56): vllm-project#35536 vllm-project#36616 vllm-project#38895 vllm-project#39155 vllm-project#39324 vllm-project#39562 vllm-project#39805 vllm-project#40398 vllm-project#40726
Runner fix (2): vllm-project#44568 vllm-project#44603

Skipped: vllm-project#43781 (ROCm-specific, not applicable to Ascend NPU)

Conflict resolutions:
- Manual merge: vllm-project#43286 vllm-project#45118 vllm-project#42112 vllm-project#43160 vllm-project#43719 vllm-project#44560
- Upstream-preferred (-X theirs): vllm-project#43808 vllm-project#43988 vllm-project#42967 vllm-project#35536 vllm-project#45195
- Test files (--theirs): vllm-project#44744 vllm-project#41895 vllm-project#42040 vllm-project#41233 vllm-project#45345 vllm-project#43982

Co-authored-by: GitHub Copilot
Signed-off-by: MingqiWang-coder <mingqiwang@hust.edu.cn>
philippesic pushed a commit to philippesic/vllm-semantic-cache that referenced this pull request Jul 19, 2026
…#42112)

Signed-off-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working nvidia ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants