Skip to content

Conversation

elvischenv
Copy link
Contributor

@elvischenv elvischenv commented Jul 24, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

There is an always valid workspace_buffer initialized in attn_metadata.decode_wrapper._float_workspace_buffer, so no need to store the extra one attn_metadata.workspace_buffer. They should be the same.

Original PR(#19825) initialize attn_metadata via the following way, self._workspace_buffer will be None at the beginning, and will be allocated after ONE round of self._plan(). So it will only get the correct assignment at the 2nd round of build().

attn_metadata = FlashInferMetadata(
    ....
    workspace_buffer=self._workspace_buffer,
)

self._plan(...)

There is one PR(#21137) likely fixed the issue a while ago, but I think it is better to just remove this duplicated attribute.

attn_metadata = FlashInferMetadata(
    ....
    workspace_buffer=self._get_workspace_buffer(),
)

Also fixed unit test for the breakage API for #21485.

Test Plan

tests/kernels/attention/test_flashinfer_trtllm_decode_attention.py
lm_eavl

Test Result

===== 96 passed, 1 warning in 121.20s (0:02:01) =====
vllm (pretrained=nvidia/Llama-4-Scout-17B-16E-Instruct-FP8,quantization=modelopt,tensor_parallel_size=1,max_model_len=2048,kv_cache_dtype=auto,trust_remote_code=True), gen_kwargs: (temperature=0.0), limit: 500.0, num_fewshot: 5, batch_size: 200
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value|   |Stderr|
|-----|------:|----------------|-----:|-----------|---|----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match|↑  |0.932|±  |0.0113|
|     |       |strict-match    |     5|exact_match|↑  |0.914|±  |0.0126|

(Optional) Documentation Update

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added the v1 label Jul 24, 2025
Copy link
Contributor

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

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 fixes a potential None pointer issue with the workspace buffer in the FlashInfer TRTLLM backend by removing a redundant workspace_buffer attribute from FlashInferMetadata and instead sourcing the buffer directly from the decode_wrapper. The change is logical and improves robustness. However, I've identified a critical potential issue where the code now uses _float_workspace_buffer while the older, more established backend implementation uses _int_workspace_buffer for the same function call. This discrepancy needs to be addressed to prevent potential runtime errors or incorrect computations.

@elvischenv elvischenv force-pushed the elvischenv/fix-workspace-buffer-trtllm branch from 40d3415 to 78b341b Compare July 24, 2025 12:12
@elvischenv elvischenv changed the title [Bugfix] Fix None workspace buffer issue for Flashinfer TRTLLM Backend [Bugfix] Fix workspace buffer None issue for Flashinfer TRTLLM Backend Jul 24, 2025
@elvischenv elvischenv force-pushed the elvischenv/fix-workspace-buffer-trtllm branch from 78b341b to dadc54b Compare July 25, 2025 00:02
@elvischenv elvischenv requested a review from tlrmchlsmth as a code owner July 25, 2025 00:02
@elvischenv
Copy link
Contributor Author

CC @mgoin for review. Thanks.

@elvischenv elvischenv force-pushed the elvischenv/fix-workspace-buffer-trtllm branch 2 times, most recently from 23ca680 to bb27433 Compare July 28, 2025 04:54
@mergify mergify bot added the performance Performance-related issues label Jul 28, 2025
@elvischenv elvischenv force-pushed the elvischenv/fix-workspace-buffer-trtllm branch from bb27433 to 84e689c Compare July 28, 2025 05:02
Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

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

LGTM and verified locally, thank you!

@mgoin mgoin enabled auto-merge (squash) July 28, 2025 19:33
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 28, 2025
@mgoin
Copy link
Member

mgoin commented Jul 28, 2025

Failures in CI look related


[2025-07-28T19:57:25Z] x = tensor([[[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
--
  | [2025-07-28T19:57:25Z]           0., 0....., 0.,
  | [2025-07-28T19:57:25Z]           0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]],
  | [2025-07-28T19:57:25Z]        dtype=torch.float16)
  | [2025-07-28T19:57:25Z] expected_shape = torch.Size([1, 12, 64]), expected_dtype = torch.float16
  | [2025-07-28T19:57:25Z] expected_device = device(type='cuda', index=0), name = 'out'
  | [2025-07-28T19:57:25Z]
  | [2025-07-28T19:57:25Z]     def _check_shape_dtype_device(
  | [2025-07-28T19:57:25Z]         x: torch.Tensor,
  | [2025-07-28T19:57:25Z]         expected_shape: Sequence[int],
  | [2025-07-28T19:57:25Z]         expected_dtype: torch.dtype,
  | [2025-07-28T19:57:25Z]         expected_device: torch.device,
  | [2025-07-28T19:57:25Z]         name: str,
  | [2025-07-28T19:57:25Z]     ) -> None:
  | [2025-07-28T19:57:25Z]         if x.shape != torch.Size(expected_shape):
  | [2025-07-28T19:57:25Z]             raise ValueError(
  | [2025-07-28T19:57:25Z]                 f"Invalid shape of {name}: expected {expected_shape}, got {x.shape}"
  | [2025-07-28T19:57:25Z]             )
  | [2025-07-28T19:57:25Z]         if x.dtype != expected_dtype:
  | [2025-07-28T19:57:25Z]             raise ValueError(
  | [2025-07-28T19:57:25Z]                 f"Invalid dtype of {name}: expected {expected_dtype}, got {x.dtype}"
  | [2025-07-28T19:57:25Z]             )
  | [2025-07-28T19:57:25Z]         if x.device != expected_device:
  | [2025-07-28T19:57:25Z] >           raise ValueError(
  | [2025-07-28T19:57:25Z]                 f"Invalid device of {name}: expected {expected_device}, got {x.device}"
  | [2025-07-28T19:57:25Z]             )
  | [2025-07-28T19:57:25Z] E           ValueError: Invalid device of out: expected cuda:0, got cpu

https://buildkite.com/vllm/ci/builds/25201/steps/canvas?jid=01985287-7b06-437d-bd29-9098067f382f#01985287-7b06-437d-bd29-9098067f382f/212-1920

Signed-off-by: elvischenv <[email protected]>
auto-merge was automatically disabled July 29, 2025 02:53

Head branch was pushed to by a user without write access

@elvischenv elvischenv force-pushed the elvischenv/fix-workspace-buffer-trtllm branch from 84e689c to bc30deb Compare July 29, 2025 02:53
@elvischenv
Copy link
Contributor Author

elvischenv commented Jul 29, 2025

Thanks @mgoin, fixed that in the latest commit. There is still one failure but seems to be not related?
https://buildkite.com/vllm/ci/builds/25234/steps/canvas?sid=0198541a-8a77-4f8c-929a-4b4aca2a39cb#0198541a-8b58-4920-ae6c-8dc672a23598/211-1103

[2025-07-29T03:51:09Z] >           assert end - start < 60, (
[2025-07-29T03:51:09Z]                 "Expected vLLM to gracefully shutdown in <60s "
[2025-07-29T03:51:09Z]                 "if there is an error in the startup.")
[2025-07-29T03:51:09Z] E           AssertionError: Expected vLLM to gracefully shutdown in <60s if there is an error in the startup.
[2025-07-29T03:51:09Z] E           assert (758.660869583 - 697.165792236) < 60

@mgoin
Copy link
Member

mgoin commented Jul 29, 2025

Retrying that test now

@mgoin mgoin merged commit 58b11b2 into vllm-project:main Jul 29, 2025
68 checks passed
@elvischenv elvischenv deleted the elvischenv/fix-workspace-buffer-trtllm branch July 29, 2025 15:53
liuyumoye pushed a commit to liuyumoye/vllm that referenced this pull request Jul 31, 2025
wenscarl pushed a commit to wenscarl/vllm that referenced this pull request Aug 4, 2025
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
x22x22 pushed a commit to x22x22/vllm that referenced this pull request Aug 5, 2025
Pradyun92 pushed a commit to Pradyun92/vllm that referenced this pull request Aug 6, 2025
npanpaliya pushed a commit to odh-on-pz/vllm-upstream that referenced this pull request Aug 6, 2025
jinzhen-lin pushed a commit to jinzhen-lin/vllm that referenced this pull request Aug 9, 2025
noamgat pushed a commit to noamgat/vllm that referenced this pull request Aug 9, 2025
paulpak58 pushed a commit to paulpak58/vllm that referenced this pull request Aug 13, 2025
taneem-ibrahim pushed a commit to taneem-ibrahim/vllm that referenced this pull request Aug 14, 2025
BoyuanFeng pushed a commit to BoyuanFeng/vllm that referenced this pull request Aug 14, 2025
diegocastanibm pushed a commit to diegocastanibm/vllm that referenced this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance-related issues ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants