[Attention][2/n] Remove usage of deprecated seq_lens_cpu and num_computed_tokens_cpu CommonAttentionMetadata properties#31774
Merged
DarkLight1337 merged 5 commits intovllm-project:mainfrom Jan 6, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request effectively removes the usage of the deprecated num_computed_tokens_cpu property from CommonAttentionMetadata in the GDN and Mamba attention backends. The changes correctly replace the deprecated property with direct computation. In the Mamba backends, this is cleanly handled by introducing a new helper method _get_num_computed_tokens_cpu.
I've identified one area for improvement in gdn_attn.py where a line of code appears to be redundant after the refactoring. Please see the specific comment for details.
Comment on lines
+375
to
+376
| # Note: Setting _num_computed_tokens_cpu directly for cudagraph capture | ||
| m._num_computed_tokens_cpu = m.seq_lens.cpu() - num_accepted_tokens.cpu() |
Contributor
There was a problem hiding this comment.
…ends Replace deprecated CommonAttentionMetadata.num_computed_tokens_cpu and seq_lens_cpu properties with explicit computation: num_computed_tokens = seq_lens - query_lens Changes: - mamba_attn.py: Add helper method _get_num_computed_tokens_cpu() and use it - mamba2_attn.py: Use inherited helper from base class - gdn_attn.py: Inline the computation This is part of the deprecation effort for seq_lens_cpu and num_computed_tokens_cpu properties (to be removed in v0.14.0). Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
5f53307 to
ef81b2a
Compare
Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com>
DarkLight1337
approved these changes
Jan 6, 2026
yugong333
pushed a commit
to yugong333/vllm
that referenced
this pull request
Jan 9, 2026
…omputed_tokens_cpu` CommonAttentionMetadata properties (vllm-project#31774) Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
1 task
akh64bit
pushed a commit
to akh64bit/vllm
that referenced
this pull request
Jan 16, 2026
…omputed_tokens_cpu` CommonAttentionMetadata properties (vllm-project#31774) Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
dsuhinin
pushed a commit
to dsuhinin/vllm
that referenced
this pull request
Jan 21, 2026
…omputed_tokens_cpu` CommonAttentionMetadata properties (vllm-project#31774) Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com> Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
ItzDEXX
pushed a commit
to ItzDEXX/vllm
that referenced
this pull request
Feb 19, 2026
…omputed_tokens_cpu` CommonAttentionMetadata properties (vllm-project#31774) Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com> Signed-off-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com> Co-authored-by: Cyrus Leung <cyrus.tl.leung@gmail.com>
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.
Update SSM backends