Skip to content

Conversation

@fluctlux
Copy link
Contributor

@fluctlux fluctlux commented Dec 5, 2025

What this PR does / why we need it?

Avoid oom during CI by using with VllmRunner instead of LLM(), and enable test_ngram_correctness

How was this patch tested?

Before:
image
After:
image

CI passed.

@fluctlux fluctlux marked this pull request as ready for review December 5, 2025 14:17
Copy link
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 aims to fix an Out-Of-Memory (OOM) error in CI for ngram and suffix tests. The changes involve replacing direct LLM instantiation with the VllmRunner context manager, which ensures proper resource cleanup. Additionally, the multiprocessing start method is set to 'spawn' to avoid issues with NPU context inheritance. The test test_ngram_correctness is also re-enabled.

The changes are logical and address the OOM issue effectively. My main feedback is regarding how the environment variable is set. Using os.environ at the module level can introduce side effects to other tests. I've suggested a more robust approach using pytest's monkeypatch fixture to scope the change correctly.


from tests.e2e.conftest import VllmRunner

os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Modifying os.environ directly at the module level can lead to side effects in other tests, as it's a global state change that persists throughout the pytest session. This can make tests flaky and hard to debug.

A safer and more idiomatic pytest approach is to use the monkeypatch fixture to manage environment variables. This ensures that the change is properly scoped and cleaned up after the tests in this module are done.

You could define a module-scoped autouse fixture like this, which would replace the direct modification of os.environ:

import pytest

@pytest.fixture(scope="module", autouse=True)
def set_spawn_method(monkeypatch):
    monkeypatch.setenv("VLLM_WORKER_MULTIPROC_METHOD", "spawn")

This would make the test suite more robust against side-effects.

@fluctlux fluctlux changed the title [CI] Fix ngram & suffix test OOM [CI] Fix ngram & suffix test oom Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

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

@wangxiyuan wangxiyuan added ready read for review ready-for-test start test by label for PR labels Dec 6, 2025
Copy link
Collaborator

@wangxiyuan wangxiyuan left a comment

Choose a reason for hiding this comment

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

Hope the test can works now

@wangxiyuan wangxiyuan merged commit 9fbcfa3 into vllm-project:main Dec 8, 2025
13 of 15 checks passed
@wangxiyuan
Copy link
Collaborator

really nice change. Thanks very much!!

@fluctlux fluctlux deleted the fix-ngram-ci branch December 8, 2025 01:37
yuxingcyx pushed a commit to yuxingcyx/vllm-ascend that referenced this pull request Dec 8, 2025
### What this PR does / why we need it?
Avoid oom during CI by using `with VllmRunner` instead of `LLM()`, and
enable `test_ngram_correctness`

### How was this patch tested?
CI passed.

- vLLM version: v0.12.0
- vLLM main:
vllm-project/vllm@ad32e3e

---------

Signed-off-by: fluctlux <[email protected]>
Co-authored-by: wangxiyuan <[email protected]>
Signed-off-by: yuxingcyx <[email protected]>
yuxingcyx pushed a commit to yuxingcyx/vllm-ascend that referenced this pull request Dec 8, 2025
### What this PR does / why we need it?
Avoid oom during CI by using `with VllmRunner` instead of `LLM()`, and
enable `test_ngram_correctness`

### How was this patch tested?
CI passed.

- vLLM version: v0.12.0
- vLLM main:
vllm-project/vllm@ad32e3e

---------

Signed-off-by: fluctlux <[email protected]>
Co-authored-by: wangxiyuan <[email protected]>
Signed-off-by: yuxingcyx <[email protected]>
Clorist33 pushed a commit to Clorist33/vllm-ascend that referenced this pull request Dec 9, 2025
### What this PR does / why we need it?
Avoid oom during CI by using `with VllmRunner` instead of `LLM()`, and
enable `test_ngram_correctness`

### How was this patch tested?
CI passed.

- vLLM version: v0.12.0
- vLLM main:
vllm-project/vllm@ad32e3e

---------

Signed-off-by: fluctlux <[email protected]>
Co-authored-by: wangxiyuan <[email protected]>
Signed-off-by: tanqingshan (A) <[email protected]>
Clorist33 pushed a commit to Clorist33/vllm-ascend that referenced this pull request Dec 10, 2025
### What this PR does / why we need it?
Avoid oom during CI by using `with VllmRunner` instead of `LLM()`, and
enable `test_ngram_correctness`

### How was this patch tested?
CI passed.

- vLLM version: v0.12.0
- vLLM main:
vllm-project/vllm@ad32e3e

---------

Signed-off-by: fluctlux <[email protected]>
Co-authored-by: wangxiyuan <[email protected]>
Mercykid-bash pushed a commit to Mercykid-bash/vllm-ascend that referenced this pull request Dec 10, 2025
### What this PR does / why we need it?
Avoid oom during CI by using `with VllmRunner` instead of `LLM()`, and
enable `test_ngram_correctness`

### How was this patch tested?
CI passed.

- vLLM version: v0.12.0
- vLLM main:
vllm-project/vllm@ad32e3e

---------

Signed-off-by: fluctlux <[email protected]>
Co-authored-by: wangxiyuan <[email protected]>
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 ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants