Skip to content

[Test][BugFix] Fix torch.rand usage in triton penalty test#6680

Merged
zzzzwwjj merged 1 commit intovllm-project:mainfrom
whx-sjtu:fix_triton_ci
Feb 11, 2026
Merged

[Test][BugFix] Fix torch.rand usage in triton penalty test#6680
zzzzwwjj merged 1 commit intovllm-project:mainfrom
whx-sjtu:fix_triton_ci

Conversation

@whx-sjtu
Copy link
Copy Markdown
Collaborator

@whx-sjtu whx-sjtu commented Feb 11, 2026

What this PR does / why we need it?

This PR fixes a TypeError in tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py that was causing nightly test failures. The torch.rand() function was being called with the device string as a positional argument, which is incorrect. This has been corrected to use the device keyword argument.

Fixes #

Does this PR introduce any user-facing change?

No, this change only affects a test file.

How was this patch tested?

CI is expected to pass with this fix.

Signed-off-by: whx-sjtu <2952154980@qq.com>
@whx-sjtu whx-sjtu requested a review from wangxiyuan as a code owner February 11, 2026 04:25
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @whx-sjtu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue in the Triton-related nightly tests by ensuring that random tensors generated within the test data creation utility are correctly placed on the specified device. This prevents potential device mismatch errors and improves the reliability of the tests.

Highlights

  • Fix torch.rand device argument: Corrected the device argument in torch.rand calls from torch.rand(1, device) to torch.rand(1, device=device) within the create_test_data function. This addresses an issue where the random tensor might not be placed on the intended device, leading to potential errors in Triton-related nightly tests.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py
    • Updated torch.rand calls to explicitly use the device=device keyword argument for proper tensor device placement.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

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 addresses errors in a Triton-related nightly test by correcting the usage of torch.rand. The change correctly uses a keyword argument for the device parameter. However, I've found a critical bug in the modified code that was present before: the temperature variable is not being updated correctly. I've added a specific comment to address this.

In line with the repository's style guide, I'm also suggesting an updated PR title and a summary to better describe the changes.

Suggested PR Title:

[Test][BugFix] Fix torch.rand usage in triton penalty test

Suggested PR Summary:

### What this PR does / why we need it?
This PR fixes a `TypeError` in `tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py` that was causing nightly test failures. The `torch.rand()` function was being called with the `device` string as a positional argument, which is incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

for i in range(num_reqs):
if torch.rand(1) > 0.2:
presence_penalty[i] = torch.rand(1, device).item() * 1.8 + 0.2
presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

There appears to be a copy-paste error here. This loop is intended to initialize the temperature tensor, but this line is modifying presence_penalty instead. This will result in incorrect test data, with temperature remaining as a tensor of ones and presence_penalty being potentially overwritten.

Suggested change
presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2
temperature[i] = torch.rand(1, device=device).item() * 1.8 + 0.2

@whx-sjtu whx-sjtu changed the title [Nightly][Bugfix] Fix triton-related nightly test errors. [Test][BugFix] Fix torch.rand usage in triton penalty test Feb 11, 2026
@whx-sjtu whx-sjtu added the ready read for review label Feb 11, 2026
@zzzzwwjj zzzzwwjj merged commit bb73478 into vllm-project:main Feb 11, 2026
32 checks passed
mikequan0425 pushed a commit to taoyao1221/vllm-ascend that referenced this pull request Feb 11, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: mikequan0425 <mikequan0425@foxmail.com>
845473182 pushed a commit to 845473182/vllm-ascend that referenced this pull request Feb 12, 2026
…to qwen3next_rebase

* 'main' of https://github.com/vllm-project/vllm-ascend:
  [Docs] Fix GLM-5 deploy command (vllm-project#6711)
  [npugraph_ex]enable npugraph_ex by default (vllm-project#6664)
  [doc]add GLM5.md (vllm-project#6709)
  [Model] GLM5 adaptation (vllm-project#6642)
  [Bugfix] Update target probs to target logits in rejection sample (vllm-project#6685)
  [Main][Ops] Make triton rope support index_selecting from cos_sin_cache (vllm-project#5450)
  [CI]fix nightly multi node test error for wait for pod ready (vllm-project#6675)
  [main  to main] upgrade main 0210 (vllm-project#6673)
  [main][Quant] Remove unused rotation functions and parameters from W4A4 LAOS quantization (vllm-project#6648)
  [Test][BugFix] Fix torch.rand usage in triton penalty test (vllm-project#6680)
  Add Worker Interface:check_health (vllm-project#6681)
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Feb 12, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: momochenchuw <chenchuw@huawei.com>
banxiaduhuo pushed a commit to banxiaduhuo/vllm-ascend that referenced this pull request Feb 26, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Feb 28, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
maoxx241 pushed a commit to maoxx241/vllm-ascend that referenced this pull request Mar 2, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
ZRJ026 pushed a commit to ZRJ026/vllm-ascend that referenced this pull request Mar 4, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
Signed-off-by: zrj026 <zhangrunjiang026@gmail.com>
LCAIZJ pushed a commit to LCAIZJ/vllm-ascend that referenced this pull request Mar 7, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
yangzhe-2026 pushed a commit to yangzhe-2026/vllm-ascend that referenced this pull request May 6, 2026
…ect#6680)

### What this PR does / why we need it?
This PR fixes a `TypeError` in
`tests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_penality.py`
that was causing nightly test failures. The `torch.rand()` function was
being called with the `device` string as a positional argument, which is
incorrect. This has been corrected to use the `device` keyword argument.

Fixes #

### Does this PR introduce _any_ user-facing change?
No, this change only affects a test file.

### How was this patch tested?
CI is expected to pass with this fix.

- vLLM version: v0.15.0
- vLLM main:
vllm-project/vllm@1339784

Signed-off-by: whx-sjtu <2952154980@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:tests ready read for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants