Skip to content

[OMNIML-6178] [2/11] Use the sysmon coverage core in CI - #2846

Open
shengliangxu wants to merge 1 commit into
shengliangx/ci-1-unit-xdistfrom
shengliangx/ci-2-coverage
Open

shengliangxu wants to merge 1 commit into
shengliangx/ci-1-unit-xdistfrom
shengliangx/ci-2-coverage

Conversation

@shengliangxu

@shengliangxu shengliangxu commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: CI (test runtime)

Sets COVERAGE_CORE=sysmon on the unit linux job, gpu_tests.yml and regression_tests.yml. Python 3.12 defaults to coverage's C tracer, which slows every line of Python run under it, and every lane starts coverage in each spawned worker and subprocess through COVERAGE_PROCESS_START, so import-heavy start-ups pay for it (the 76 s Megatron pool start, the 22 s hf_ptq processes of the unified-export tests, the puzzletron spawns, the vLLM engine core). sysmon records the same lines through sys.monitoring. The example runner is left to #2727, which makes the same change there. On a Python older than 3.12 coverage warns and keeps its default core, so a lane that turned out to run an older Python would be slower, not broken (the gpu and gpu_megatron logs show 3.12).

Time improvement (measured in CI)

pytest time of each lane in the run of #2845 (the base of this PR) and in this PR's run, one run each:

lane #2845 this PR change
gpu 2,093 s 1,289 s -38%
gpu_megatron 2,240 s 1,212 s -46%
gpu_vllm v0.20.0 204 s 170 s -17%
gpu_vllm v0.30.0 426 s 328 s -23%
regression 366 s 268 s -27%
unit linux (xdist) 479 s 305 s -36%

Workflow wall time: GPU tests 59.2 -> 39.6 min, Regression 21.3 -> 15.2 min.

  • How much of that is this PR. Two single runs of the same code differ by 15-30% on their own: the eight example lanes that run over 100 s, which this PR does not touch, moved by -4% to -31% (llm_sparsity +38%) between the same two runs. The deterministic part is the Megatron worker-pool start, the setup of the first test of each gpu_megatron module: 75-77 s in each of 14 modules before (all setups of 12 s or more add up to 1,365 s) and 22-27 s after (575 s), which is 790 s of the lane's 1,028 s. Locally the unit suite takes 825 s with the C tracer, 640 s with sysmon and 572 s without coverage (4 CPUs, serial).
  • A coverage.xml-only report change was dropped from this PR. The runs above are of its earlier head, which also had it. It showed no CI effect: the pytest summary line came 1-4 s after the last test in the [OMNIML-6178] [1/11] Run the unit tests in parallel with pytest-xdist #2845 runs, which still wrote the html report, and 0-3 s in this PR's runs (median 1.1 s over the 82 lane runs of the series), so the table is the sysmon core's. It would only have saved developers' local runs (about 25 s per pytest session).

Method: every PR of the series has its own CI run, so "before" is the run of the PR(s) below that lack the change and "after" the runs that carry it. Times come from the job logs (--durations, or the gap between consecutive result lines). Where runner speed matters, the tests that no PR of the series touches scale each run, and the raw and the scaled medians are both shown. One test varies by 15-30% from run to run on its own, so smaller differences are not evidence.

Usage

Nothing user-facing.

Testing

Measured on this tree (tests/unit on 4 CPUs serial: 572 s without coverage, 825 s with the C tracer, 640 s with sysmon; import modelopt.torch.quantization.extensions: 17.1 s native, 23.6 s with the C tracer, 18.3 s with sysmon, with the same 362 files and 13,821 executed lines in the spawned child's data file; one TinyLlama fp8 plus TRT-LLM deploy test: 64.8 s without coverage, 103.3 s with the C tracer, 70.5 s with sysmon, identical covered lines). Pre-commit and actionlint pass. The CI runs of the series are the check on real runners (time section above).

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: N/A (CI and tests)
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: no new dependency
  • Did you write any new necessary tests?: N/A (CI configuration)
  • Did you update Changelog?: N/A (CI and tests)
  • Did you get Claude approval on this PR?: N/A (optional, not run)

Additional Information

Slice 2 of 11 of the GPU-CI speed-up work, split out of the reference draft #2730 (not for merge; it holds the whole series with its measurements). Merge in order; each PR stands on its own and passes CI without the later ones.

  1. [OMNIML-6178] [1/11] Run the unit tests in parallel with pytest-xdist #2845 [OMNIML-6178] [1/11] Run the unit tests in parallel with pytest-xdist
  2. [OMNIML-6178] [2/11] Use the sysmon coverage core in CI #2846 [OMNIML-6178] [2/11] Use the sysmon coverage core in CI (this PR)
  3. [OMNIML-6179] [3/11] Run release-marked tests on nightly and on-demand GPU runs #2847 [OMNIML-6179] [3/11] Run release-marked tests on nightly and on-demand GPU runs
  4. [OMNIML-6181] [4/11] Give gpu_megatron's slow cold starts more time #2848 [OMNIML-6181] [4/11] Give gpu_megatron's slow cold starts more time
  5. [OMNIML-6179] [5/11] Make the ONNX tests cheaper: CPU-only ones to the unit lane, small models #2849 [OMNIML-6179] [5/11] Make the ONNX tests cheaper: CPU-only ones to the unit lane, small models
  6. [OMNIML-6179] [6/11] Use local tokenizers and calibration text in GPU tests, shrink puzzletron data #2850 [OMNIML-6179] [6/11] Use local tokenizers and calibration text in GPU tests, shrink puzzletron data
  7. [OMNIML-6180] [7/11] Trim the llm_eval, llm_qat, EAGLE and megatron_bridge example tests #2851 [OMNIML-6180] [7/11] Trim the llm_eval, llm_qat, EAGLE and megatron_bridge example tests
  8. [OMNIML-6180] [8/11] Trim the DFlash regression test #2852 [OMNIML-6180] [8/11] Trim the DFlash regression test
  9. [OMNIML-6180] [9/11] Trim the torch_onnx example lane #2853 [OMNIML-6180] [9/11] Trim the torch_onnx example lane
  10. [OMNIML-6181] [10/11] Make the distributed worker pool fail fast when a worker dies #2854 [OMNIML-6181] [10/11] Make the distributed worker pool fail fast when a worker dies
  11. [OMNIML-6181] [11/11] Share one Megatron worker pool across the gpu_megatron modules #2855 [OMNIML-6181] [11/11] Share one Megatron worker pool across the gpu_megatron modules

Summary by CodeRabbit

  • Tests
    • Updated coverage collection for GPU, regression, and Linux unit-test runs to use Python’s monitoring-based coverage core on supported Python versions. No changes to application functionality are included.

@copy-pr-bot

copy-pr-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 48113bd2-57df-4288-92e2-b92a1808d0ef
📥 Commits

Reviewing files that changed from the base of the PR and between c84359c and 2574994.

📒 Files selected for processing: 3
  • .github/workflows/gpu_tests.yml
  • .github/workflows/regression_tests.yml
  • .github/workflows/unit_tests.yml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

📝 Walkthrough

The Linux unit-test, regression-test, and GPU-test workflows set COVERAGE_CORE to sysmon. Comments describe the sys.monitoring core and its Python 3.12+ requirement.

Changes: Coverage core in CI tests

Layer / File(s) Summary
Set coverage core in test workflows
.github/workflows/*_tests.yml
The Linux unit-test, regression-test, and GPU-test workflows set COVERAGE_CORE to sysmon. Comments describe sys.monitoring and its Python 3.12+ requirement.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: kevalmorabia97

Merge Risk: ⚪ Minimal · up to 25749

The change selects sysmon for CI coverage tracing. Confirmed lanes support it; older Python falls back instead of failing tests. One GPU image’s speedup is uncertain, but no concrete workflow regression is established, so the PR is mergeable.

Pre-merge checks: Passed 6
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: enabling the sysmon coverage core in CI workflows.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
Security Anti-Patterns Passed PASS. The pull request changes only three GitHub Actions workflow files and adds COVERAGE_CORE=sysmon environment settings. It does not change modelopt or examples Python files, dependency manif…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)

Full details: Security Anti-Patterns

Explanation

PASS. The pull request changes only three GitHub Actions workflow files and adds COVERAGE_CORE=sysmon environment settings. It does not change modelopt or examples Python files, dependency manifests, or security-sensitive loading or execution code. Therefore, none of the listed security anti-patterns is introduced.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.10%. Comparing base (c84359c) to head (2574994).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           shengliangx/ci-1-unit-xdist    #2846      +/-   ##
===============================================================
+ Coverage                        76.53%   79.10%   +2.57%     
===============================================================
  Files                              658      658              
  Lines                            73950    73950              
===============================================================
+ Hits                             56594    58498    +1904     
+ Misses                           17356    15452    -1904     
Flag Coverage Δ
gpu 59.56% <ø> (+8.99%) ⬆️
regression 15.10% <ø> (ø)
unit 60.40% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 1c8d165

@shengliangxu shengliangxu changed the title [2/11] Cut the coverage overhead in CI: coverage.xml only, sysmon core [2/12] Cut the coverage overhead in CI: coverage.xml only, sysmon core Oct 17, 2026
@shengliangxu
shengliangxu removed this pull request from stack #2856 October 17, 2026 06:58
@shengliangxu
shengliangxu force-pushed the shengliangx/ci-2-coverage branch from 1c8d165 to 73d351b Compare October 17, 2026 07:02
@shengliangxu
shengliangxu added this pull request to stack #2859 October 17, 2026 07:02
@shengliangxu shengliangxu changed the title [2/12] Cut the coverage overhead in CI: coverage.xml only, sysmon core [2/11] Use the sysmon coverage core in CI Oct 17, 2026
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 73d351b

@shengliangxu shengliangxu changed the title [2/11] Use the sysmon coverage core in CI [OMNIML-6178] [2/11] Use the sysmon coverage core in CI Oct 18, 2026
Python 3.12 defaults to coverage's C tracer, which slows every line of Python
that runs under it. Every lane starts coverage in each spawned worker and
subprocess through COVERAGE_PROCESS_START, so the import-heavy start-ups pay
for it: the 76 s Megatron worker-pool start, the 22 s hf_ptq processes of the
unified-export tests, the puzzletron spawns, the vLLM engine core.
COVERAGE_CORE=sysmon records the same lines through sys.monitoring at a
fraction of the overhead.

Measured (the first three here, the last by #2727 on its hf_ptq example lane):
- serial tests/unit run on 4 CPUs: 572 s without coverage, 825 s with the C
  tracer, 640 s with sysmon;
- `import modelopt.torch.quantization.extensions` with this repo's coverage
  config: 17.1 s native, 23.6 s with the C tracer, 18.3 s with sysmon, and the
  child process of a spawn writes its data file too, with the same 362 files
  and 13,821 executed lines;
- one TinyLlama fp8 plus TRT-LLM deploy test: 64.8 s without coverage, 103.3 s
  with the C tracer, 70.5 s with sysmon, identical covered lines.

Applies to the unit `linux` job (Python 3.12), gpu_tests.yml and
regression_tests.yml. The example runner is left to #2727, which makes the same
change there. sysmon needs Python 3.12 or newer; on an older interpreter
coverage warns and keeps its default core, so a lane that turns out to run an
older Python is slower, not broken. The gpu and gpu_megatron logs show 3.12.

Testing: actionlint is clean on all workflows. Not yet run on a real CI runner;
the first run should be compared against the previous coverage.xml.

Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
@shengliangxu
shengliangxu force-pushed the shengliangx/ci-2-coverage branch from 73d351b to 2574994 Compare October 18, 2026 23:15
@shengliangxu
shengliangxu marked this pull request as ready for review October 19, 2026 03:44
@shengliangxu
shengliangxu requested a review from a team as a code owner October 19, 2026 03:44

This branch has not been deployed

No deployments
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.

1 participant