Fix HPU prompt_token_ids device placement for penalty sampling#1465
Merged
iboiko-habana merged 3 commits intoMay 25, 2026
Conversation
Move prompt_token_ids to self.device in selective sampling metadata creation for both skip_copy paths. This keeps prompt and output penalty masks on the same device and prevents runtime device mismatch errors during repetition/presence/frequency penalty application. Signed-off-by: Yeonsil Yoon <yeon.sil.yoon@intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates selective sampling metadata creation to ensure prompt_token_ids tensors are moved onto the worker device for penalty application.
Changes:
- Move
prompt_token_ids(from freshly-built CPU tensor) toself.devicewithnon_blocking=True. - Move cached
prompt_token_idsslices toself.devicewhenskip_copy=Trueand penalties are enabled.
Comment on lines
+643
to
+644
| prompt_token_ids = self._make_prompt_token_ids_cpu_tensor()[req_indices].to(device=self.device, | ||
| non_blocking=True) |
Comment on lines
+649
to
+650
| prompt_token_ids = cached_tensor[req_indices].to( | ||
| device=self.device, non_blocking=True) if cached_tensor is not None else None |
Comment on lines
+649
to
+650
| prompt_token_ids = cached_tensor[req_indices].to( | ||
| device=self.device, non_blocking=True) if cached_tensor is not None else None |
iboiko-habana
approved these changes
May 19, 2026
✅ CI PassedAll checks passed successfully against the following vllm commit: |
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.
Move prompt_token_ids to self.device in selective sampling metadata creation for both skip_copy paths.
This keeps prompt and output penalty masks on the same device and prevents runtime device mismatch errors during repetition/presence/frequency penalty application.