Skip to content

[CI ][Misc] Add timeout check for custom op CI and optimize test parameters - #8755

Merged
yiz-liu merged 1 commit into
vllm-project:releases/v0.18.0from
ZT-AIA:ci_customop_0427
Apr 27, 2026
Merged

yiz-liu merged 1 commit into
vllm-project:releases/v0.18.0from
ZT-AIA:ci_customop_0427

Conversation

@ZT-AIA

@ZT-AIA ZT-AIA commented Apr 27, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

This PR introduces a mechanism to track test duration in conftest.py and skip subsequent tests in a file if a certain number of tests exceed a timeout threshold. This is intended to prevent CI hangs or long-running nightly tests. Additionally, it reduces the parameter space for test_fused_qkvzba_split_reshape_cat.py to further optimize CI runtime.

Does this PR introduce any user-facing change?

no

How was this patch tested?

nightly

Signed-off-by: ZT-AIA <1028681969@qq.com>
@ZT-AIA
ZT-AIA requested a review from wangxiyuan as a code owner April 27, 2026 09:02
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 improves the stability of the CI pipeline by implementing a timeout check for custom operations. It adds logic to track slow test cases and skip them if they exceed defined limits, while also reducing the test matrix for specific fused operations to ensure faster and more reliable test runs.

Highlights

  • CI Timeout Mechanism: Introduced a new timeout monitoring mechanism in the test suite to detect and skip test cases that consistently exceed the duration threshold.
  • Test Parameter Reduction: Reduced the parameter space for the fused QKV test to improve execution efficiency and prevent CI timeouts.

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

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.

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

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces a timeout mechanism in conftest.py to skip remaining tests in a file once a specific number of tests exceed a duration threshold, and it optimizes CI runtime by reducing the parameter space for test_fused_qkvzba_split_reshape_cat.py. Feedback indicates that the PR title and summary must be updated to comply with the repository's style guide. Additionally, the logic for skipping tests should be improved by checking the per-file slow case count directly instead of relying on a single global variable, which could be overwritten when multiple files are processed.

from datetime import datetime
import pytest

DURATION_THRESHOLD = 120

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.

high

The Pull Request title and summary do not adhere to the repository's style guide regarding format and required sections.

Suggested PR Title:

[CI][Misc] Add timeout check for custom op CI and optimize test parameters

Suggested PR Summary:

### What this PR does / why we need it?

This PR introduces a mechanism to track test duration in `conftest.py` and skip subsequent tests in a file if a certain number of tests exceed a timeout threshold. This is intended to prevent CI hangs or long-running nightly tests. Additionally, it reduces the parameter space for `test_fused_qkvzba_split_reshape_cat.py` to further optimize CI runtime.

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

nightly
References
  1. The PR title and summary must follow the specific format defined in the Repository Style Guide, including the [Branch][Module][Action] prefix for the title and specific headers for the summary. (link)

Comment on lines +9 to +40
_per_file_slow_cases = {}
_current_file = None


def pytest_runtest_setup(item):
item.start_time = time.time()


def pytest_runtest_teardown(item, nextitem):
global _current_file

file_path = item.fspath
duration = time.time() - item.start_time


if file_path not in _per_file_slow_cases:
_per_file_slow_cases[file_path] = 0

if duration > DURATION_THRESHOLD:
_per_file_slow_cases[file_path] += 1
cnt = _per_file_slow_cases[file_path]
print(f" Detected that the test case took too long, ({cnt}/{SLOW_COUNT_LIMIT}):{duration:.2f}s")

if cnt >= SLOW_COUNT_LIMIT:
print(f"\n The number of timeout test cases {file_path} ≥{SLOW_COUNT_LIMIT}\n")
_current_file = file_path


def pytest_runtest_call(item):
if _current_file == item.fspath:
print(f"CASE SKIP:{item.nodeid}")
pytest.skip(f"The use case takes too long.")

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.

high

The current implementation uses a single global variable _current_file to track which file should be skipped. This logic is flawed if multiple test files are executed: once a new file exceeds the SLOW_COUNT_LIMIT, _current_file is overwritten, and any remaining tests in previously "timed out" files will no longer be skipped.

I suggest using the _per_file_slow_cases dictionary directly to check the skip condition for each file, which is more robust and removes the need for the _current_file global variable.

_per_file_slow_cases = {}


def pytest_runtest_setup(item):
    item.start_time = time.time()


def pytest_runtest_teardown(item, nextitem):
    file_path = item.fspath
    duration = time.time() - item.start_time

    if duration > DURATION_THRESHOLD:
        _per_file_slow_cases[file_path] = _per_file_slow_cases.get(file_path, 0) + 1
        cnt = _per_file_slow_cases[file_path]
        print(f" Detected that the test case took too long, ({cnt}/{SLOW_COUNT_LIMIT}):{duration:.2f}s")

        if cnt >= SLOW_COUNT_LIMIT:
            print(f"\n The number of timeout test cases  {file_path}   ≥{SLOW_COUNT_LIMIT}\n")


def pytest_runtest_call(item):
    if _per_file_slow_cases.get(item.fspath, 0) >= SLOW_COUNT_LIMIT:
        print(f"CASE SKIP:{item.nodeid}")
        pytest.skip("The use case takes too long.")

@ZT-AIA ZT-AIA changed the title [CI ]repair custom op ci [CI ][Misc] Add timeout check for custom op CI and optimize test parameters Apr 27, 2026
@yiz-liu
yiz-liu merged commit 0cc7686 into vllm-project:releases/v0.18.0 Apr 27, 2026
22 of 23 checks passed
immengzi pushed a commit to immengzi/vllm-ascend that referenced this pull request May 21, 2026
…meters (vllm-project#8755)

### What this PR does / why we need it?

This PR introduces a mechanism to track test duration in `conftest.py`
and skip subsequent tests in a file if a certain number of tests exceed
a timeout threshold. This is intended to prevent CI hangs or
long-running nightly tests. Additionally, it reduces the parameter space
for `test_fused_qkvzba_split_reshape_cat.py` to further optimize CI
runtime.

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

nightly

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants