[https://nvbugs/6437342][fix] Add --dist=loadfile to the child pytest cmd list so all tests in one file…#16329
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe standalone package test runner now passes ChangesStandalone test execution
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/bot run |
|
PR_Github #59107 [ run ] triggered by Bot. Commit: |
|
PR_Github #59107 [ run ] completed with state
|
Summary
--dist=loadwhich 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).--dist=loadfileto the child pytest cmd list so all tests in one file run on the same worker in file-declaration order; keep-n 4for wall-clock, but restore deterministic in-file execution so per-test RNG state is reproducible.Test plan
Links
Summary by CodeRabbit