Skip to content

[https://nvbugs/6437342][fix] Add --dist=loadfile to the child pytest cmd list so all tests in one file…#16329

Open
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6437342
Open

[https://nvbugs/6437342][fix] Add --dist=loadfile to the child pytest cmd list so all tests in one file…#16329
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6437342

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: pytest -n 4 subprocess uses xdist's default --dist=load which dispatches tests dynamically across workers, breaking module-level torch.manual_seed(0) determinism and intermittently tripping tight tolerances in numerical child tests (flashinfer_mla, gemm_fusion) and mem_get_info-based assertions (piecewise_memory).
  • Fix: Add --dist=loadfile to the child pytest cmd list so all tests in one file run on the same worker in file-declaration order; keep -n 4 for wall-clock, but restore deterministic in-file execution so per-test RNG state is reproducible.
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Summary by CodeRabbit

  • Tests
    • Improved test execution stability by enforcing deterministic ordering for standalone parallel test runs.
    • Reduced intermittent numerical tolerance failures caused by inconsistent test ordering.

The outer test_run_unit_tests spawns a pytest -n 4 subprocess over 1800+
child tests. Under xdist's default --dist=load, tests are dispatched
dynamically to workers, so module-level torch.manual_seed(0) no longer
produces a stable RNG state at each test entry. This intermittently trips
tight numerical tolerances in flashinfer_mla_op, gemm_fusion, and
piecewise_memory child tests, and the outer 'assert num_failed == 0' at
test_standalone_package.py:313 fires with a different failing test on
each run.

Add --dist=loadfile so all tests in one file execute on the same worker
in file-declaration order. Module-level RNG seeding then reliably
precedes the tests it is meant to seed, and per-test input state becomes
reproducible across runs. Parallelism is preserved (still 4 workers,
each running a distinct file at a time), so wall-clock stays close to
the current ~260s.

The same class of flakiness is documented in
tests/unittest/auto_deploy/singlegpu/custom_ops/rope/test_rope_op_variants.py:28,
which notes that pytest-xdist dynamic distribution 'used order-dependent
inputs and failed intermittently'.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 59ed4bcc-9ea7-449b-828b-1f600b7a69f3

📥 Commits

Reviewing files that changed from the base of the PR and between 50142a9 and 5df575f.

📒 Files selected for processing (1)
  • tests/unittest/auto_deploy/standalone/test_standalone_package.py

📝 Walkthrough

Walkthrough

The standalone package test runner now passes --dist=loadfile to pytest-xdist, keeping tests from the same file on one worker and documenting the rationale related to module-level RNG state.

Changes

Standalone test execution

Layer / File(s) Summary
File-level xdist distribution
tests/unittest/auto_deploy/standalone/test_standalone_package.py
Adds --dist=loadfile and comments describing how it prevents cross-worker interleaving and intermittent numerical tolerance failures.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: marinayanov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, correctly tagged, and matches the main fix: adding --dist=loadfile for deterministic standalone pytest runs.
Description check ✅ Passed The description covers the root cause, fix, tests, and bug link, though it uses custom headings instead of the exact template sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@bmarimuthu-nv

Copy link
Copy Markdown
Collaborator

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59107 [ run ] triggered by Bot. Commit: 5df575f Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #59107 [ run ] completed with state SUCCESS. Commit: 5df575f
/LLM/main/L0_MergeRequest_PR pipeline #47619 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

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