Skip to content

[CPU] Remove speculative decoding stream overrides from CPUModelRunner#47162

Merged
bigPYJ1151 merged 2 commits into
vllm-project:mainfrom
jmamou:jmamou/remove-cpu-sd-overrides-v2
Jul 1, 2026
Merged

[CPU] Remove speculative decoding stream overrides from CPUModelRunner#47162
bigPYJ1151 merged 2 commits into
vllm-project:mainfrom
jmamou:jmamou/remove-cpu-sd-overrides-v2

Conversation

@jmamou

@jmamou jmamou commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove 4 CPU-specific method overrides (_copy_draft_token_ids_to_cpu, _get_draft_token_ids_cpu, _copy_valid_sampled_token_count, _get_valid_sampled_token_count) from CPUModelRunner that are no longer needed thanks to the monkey patches in vllm/v1/worker/cpu/shm.py
  • The GPU code path now works correctly on CPU — all CUDA stream/event operations are handled as no-ops by _StreamPlaceholder and _EventPlaceholder
  • Adds device and wait_stream attributes to _StreamPlaceholder (in both shm.py and _torch_cuda_wrapper) to satisfy torch.cuda.stream() context manager and stream.wait_stream() calls

This reduces maintenance burden and improves feature stability — the CPU backend now automatically inherits any future improvements to the GPU speculative decoding path without needing manual overrides.

Performance

No regression — TPOT is identical within noise (Xeon 8580, 120 cores, Llama-3.1-8B + Llama-3.2-1B draft, K=7):

BS=1 TPOT BS=4 TPOT
Before (with overrides) 154.4ms 322.9ms
After (overrides removed) 154.1ms 322.5ms

Test plan

  • Server starts with SD enabled (Llama-3.1-8B + Llama-3.2-1B, K=7)
  • Single request produces correct output
  • Concurrent requests (BS=4) all complete successfully with coherent output
  • TPOT benchmark confirms no performance regression

@bigPYJ1151

Remove 4 CPU-specific method overrides (_copy_draft_token_ids_to_cpu,
_get_draft_token_ids_cpu, _copy_valid_sampled_token_count,
_get_valid_sampled_token_count) that are no longer needed thanks to the
monkey patches in shm.py. The GPU code path now works correctly on CPU
with _StreamPlaceholder and _EventPlaceholder handling all CUDA
stream/event operations as no-ops.

Also adds `device` and `wait_stream` attributes to _StreamPlaceholder
in both shm.py and _torch_cuda_wrapper to satisfy torch.cuda.stream()
context manager requirements.

Reduces maintenance burden — CPU backend automatically inherits future
GPU speculative decoding improvements without manual overrides.

Signed-off-by: jmamou <[email protected]>
@mergify mergify Bot added cpu Related to CPU backends v1 labels Jun 30, 2026
@jmamou
jmamou marked this pull request as ready for review June 30, 2026 13:40

@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.

@bigPYJ1151 bigPYJ1151 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! LGTM : )

@bigPYJ1151
bigPYJ1151 enabled auto-merge (squash) July 1, 2026 04:26
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 1, 2026
@bigPYJ1151
bigPYJ1151 merged commit df802a8 into vllm-project:main Jul 1, 2026
84 checks passed
jakki-amd pushed a commit to jakki-amd/vllm that referenced this pull request Jul 6, 2026
lkk12014402 pushed a commit to lkk12014402/vllm that referenced this pull request Jul 8, 2026
mayuyuace pushed a commit to mayuyuace/vllm that referenced this pull request Jul 9, 2026
noooop pushed a commit to noooop/vllm that referenced this pull request Jul 9, 2026
philippesic pushed a commit to philippesic/vllm-semantic-cache that referenced this pull request Jul 19, 2026
plasticchris pushed a commit to plasticchris/vllm that referenced this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cpu Related to CPU backends 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