Skip to content

[UT][XPU] fix test_parallel_sampling due to global random state#42388

Merged
jikunshang merged 1 commit into
vllm-project:mainfrom
zhenwei-intel:fix_ci_5_12
May 12, 2026
Merged

[UT][XPU] fix test_parallel_sampling due to global random state#42388
jikunshang merged 1 commit into
vllm-project:mainfrom
zhenwei-intel:fix_ci_5_12

Conversation

@zhenwei-intel
Copy link
Copy Markdown
Contributor

@zhenwei-intel zhenwei-intel commented May 12, 2026

Purpose

Problem: _get_test_sampling_params uses the global random module. When run together with other test files in the same pytest session, the global random state is polluted, causing the generated n values to be larger than expected and increasing the probability of duplicate completions.

Fix: Replace the global random with a local random.Random(seed) instance to ensure n_list is deterministic regardless of test execution order.

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.

Signed-off-by: zhenwei-intel <zhenwei.liu@intel.com>
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 12, 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 _get_test_sampling_params function in tests/v1/engine/test_llm_engine.py to use a local random number generator instance initialized with a seed, ensuring deterministic sampling parameter generation. I have no feedback to provide as there were no review comments to evaluate.

@zhenwei-intel
Copy link
Copy Markdown
Contributor Author

@jikunshang PTAL

@jikunshang jikunshang added the ready ONLY add when PR is ready to merge/full CI is needed label May 12, 2026
@jikunshang jikunshang enabled auto-merge (squash) May 12, 2026 08:32
@jikunshang jikunshang disabled auto-merge May 12, 2026 08:47
@jikunshang jikunshang merged commit 07a40ed into vllm-project:main May 12, 2026
23 checks passed
weifang231 pushed a commit to weifang231/eb-vllm that referenced this pull request May 13, 2026
mfylcek pushed a commit to mfylcek/vllm that referenced this pull request May 19, 2026
jhu960213 pushed a commit to jhu960213/vllm that referenced this pull request May 20, 2026
h1t35h pushed a commit to h1t35h/vllm that referenced this pull request May 21, 2026
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.

2 participants