Skip to content

[XPU] keep generator state of sycl kernel align with pytorch#41771

Merged
jikunshang merged 5 commits into
vllm-project:mainfrom
yma11:sampler-fix
May 12, 2026
Merged

[XPU] keep generator state of sycl kernel align with pytorch#41771
jikunshang merged 5 commits into
vllm-project:mainfrom
yma11:sampler-fix

Conversation

@yma11
Copy link
Copy Markdown
Contributor

@yma11 yma11 commented May 6, 2026

Purpose

This change fixes repeated output detected by image/video input for models like deepseek-ocr, minicpm-v-4, etc.

Test Plan

Test Result


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.

@yma11 yma11 requested review from 22quinn, houseroad and njhill as code owners May 6, 2026 01:59
Copy link
Copy Markdown

@claude claude Bot left a comment

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 intel-gpu Related to Intel GPU v1 labels May 6, 2026
Copy link
Copy Markdown
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 updates the forward_xpu method in vllm/v1/sample/ops/topk_topp_sampler.py to correctly advance the random number generator state after a sampling operation. It increments the offset by the number of logit elements and updates the generator state accordingly. I have no feedback to provide as there were no review comments.

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 7, 2026

Hi @yma11, 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

@yma11
Copy link
Copy Markdown
Contributor Author

yma11 commented May 8, 2026

@jikunshang can you help take a look at this change?

torch.ops.vllm.xpu_topk_topp_sampler(
random_sampled, logits_to_return, logits, k, p, self.logprobs_mode, seeds
)
offset += logits.numel()
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.

better add some comments to illustrate reason..

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added.

)

Signed-off-by: mayuyuace <qiming1.zhang@intel.com>

Signed-off-by: Yan Ma <yan.ma@intel.com>
Signed-off-by: Yan Ma <yan.ma@intel.com>
@jikunshang jikunshang enabled auto-merge (squash) May 8, 2026 23:38
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label May 8, 2026
@jikunshang jikunshang merged commit bc03f28 into vllm-project:main May 12, 2026
56 checks passed
weifang231 pushed a commit to weifang231/eb-vllm that referenced this pull request May 13, 2026
…oject#41771)

Signed-off-by: Yan Ma <yan.ma@intel.com>
Co-authored-by: Qiming Zhang <qiming1.zhang@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
mfylcek pushed a commit to mfylcek/vllm that referenced this pull request May 19, 2026
…oject#41771)

Signed-off-by: Yan Ma <yan.ma@intel.com>
Co-authored-by: Qiming Zhang <qiming1.zhang@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
jhu960213 pushed a commit to jhu960213/vllm that referenced this pull request May 20, 2026
…oject#41771)

Signed-off-by: Yan Ma <yan.ma@intel.com>
Co-authored-by: Qiming Zhang <qiming1.zhang@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
h1t35h pushed a commit to h1t35h/vllm that referenced this pull request May 21, 2026
…oject#41771)

Signed-off-by: Yan Ma <yan.ma@intel.com>
Co-authored-by: Qiming Zhang <qiming1.zhang@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

intel-gpu Related to Intel GPU 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.

3 participants