Skip to content

Conversation

@yzh119
Copy link
Collaborator

@yzh119 yzh119 commented Nov 24, 2025

📌 Description

In #2056 , when world_size > available_gpus, we should skip UT instead of raise error.

cc @wenscarl for viz.

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Summary by CodeRabbit

  • Tests
    • Enhanced test execution logic to improve reliability when handling resource constraints.

✏️ Tip: You can customize this high-level summary in your review settings.

@yzh119
Copy link
Collaborator Author

yzh119 commented Nov 24, 2025

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

Walkthrough

A test error-handling mechanism was modified to gracefully skip test execution when GPU world size exceeds available GPUs, replacing an exception-raising approach with pytest's skip functionality for better test lifecycle management.

Changes

Cohort / File(s) Summary
Test error handling
tests/comm/test_trtllm_mnnvl_allreduce_custom_comm.py
Replaced ValueError raise with pytest.skip() when world_size > available_gpus, changing test failure behavior to skip condition

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single-line change affecting only test control flow
  • No logic modifications or added complexity
  • Straightforward error-handling refactor with clear intent

Suggested reviewers

  • wenscarl
  • cyx-6

Poem

🐰 With graceful skips and gentle hops,
No more crashes when GPU stops,
The tests now skip with pytest's care,
When resources just aren't there!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing a unittest error from PR #2056 by skipping tests instead of raising errors when world_size exceeds available_gpus.
Description check ✅ Passed The description covers the key issue (#2056 context), the fix (skip UT instead of raising error), includes a related issue reference, and completes the provided template with pre-commit and test checkboxes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf2df82 and 68f105b.

📒 Files selected for processing (1)
  • tests/comm/test_trtllm_mnnvl_allreduce_custom_comm.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy Docs
🔇 Additional comments (1)
tests/comm/test_trtllm_mnnvl_allreduce_custom_comm.py (1)

252-255: LGTM! Proper use of pytest.skip() for resource constraints.

This correctly replaces the error-raising behavior with pytest's standard skip mechanism. The check appropriately handles cases where insufficient GPUs are available, and the skip message clearly communicates both the required and available GPU counts.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yzh119, 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 unit test suite where a specific test would fail due to an insufficient number of available GPUs. Instead of crashing, the test now correctly identifies this condition and skips its execution, ensuring the test suite remains stable and provides accurate results even in environments with limited GPU resources.

Highlights

  • Unit Test Error Fix: Corrected a unit test that previously raised a ValueError when world_size exceeded available_gpus.
  • Graceful Test Skipping: Modified the test to now gracefully skip execution using pytest.skip under the condition where world_size is greater than available_gpus.
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.

@flashinfer-bot
Copy link
Collaborator

GitLab MR !160 has been created, and the CI pipeline #39054316 is currently running. I'll report back once the pipeline job completes.

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 correctly fixes a bug in a unit test that would previously raise an error instead of being skipped when an insufficient number of GPUs are available. The change to use pytest.skip is appropriate and aligns with best practices for writing tests with specific hardware requirements. I have included one suggestion to make the skip message more descriptive, which will improve the clarity of test results and maintain consistency with other tests in the project. Overall, this is a good change.

Comment on lines +253 to 255
pytest.skip(
f"world_size {world_size} is greater than available_gpus {available_gpus}"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While using pytest.skip is the correct approach here, the message could be more descriptive to improve the clarity of the test output. A more informative message that clearly states the reason for skipping would be more helpful for developers and is more consistent with other skip messages in the test suite, such as "This test requires at least 2 MPI ranks, got {world_size}". I suggest rephrasing it to be more explicit.

Suggested change
pytest.skip(
f"world_size {world_size} is greater than available_gpus {available_gpus}"
)
pytest.skip(
f"Skipping test, requires {world_size} GPUs but only {available_gpus} are available."
)

@yzh119 yzh119 enabled auto-merge (squash) November 24, 2025 08:29
@yzh119 yzh119 merged commit ecd4ef1 into flashinfer-ai:main Nov 24, 2025
4 checks passed
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.

3 participants