Skip to content

CI: upload Python coverage.json from pytest (non-blocking) - #712

Open
jiagaoxiang wants to merge 2 commits into
ROCm:devfrom
jiagaoxiang:ci/python-coverage-json
Open

CI: upload Python coverage.json from pytest (non-blocking)#712
jiagaoxiang wants to merge 2 commits into
ROCm:devfrom
jiagaoxiang:ci/python-coverage-json

Conversation

@jiagaoxiang

@jiagaoxiang jiagaoxiang commented Aug 21, 2026

Copy link
Copy Markdown

Summary

  • JUnit XML already records which tests passed or failed. This PR adds the missing layer: which installed transformer_engine Python functions actually ran during those tests.
  • Existing pytest_run is wrapped with coverage.py only when TE_COVERAGE=1 (set in ROCm CI). Local ci/pytorch.sh / ci/jax.sh runs are unchanged unless that variable is set.
  • Each sGPU / mGPU job uploads python-coverage-*/coverage.json plus a small coverage-meta.txt with the git SHA. Export is best-effort: a missing or empty report is not uploaded and does not fail the job.

This is Python-only. It does not measure C++/HIP kernels (.cu / .hip); that would need a separate instrumented build and llvm-cov. torchrun / mpirun child processes are also not included in this first step.

Test plan

  • CI still fails only when a test suite fails (coverage export errors do not fail the job).
  • After a green (or failed) sGPU/mGPU job, artifact python-coverage-sgpu-<arch> / python-coverage-mgpu-<arch>-<framework> is present only if coverage.json is non-empty and lists measured files.
  • coverage-meta.txt records the commit SHA of that job.
  • Local ci/pytorch.sh without TE_COVERAGE=1 still invokes plain python3 -m pytest.

JUnit already records which tests passed. Wrap the existing pytest
invocation with coverage.py so each CI job can publish which installed
transformer_engine Python APIs actually ran. Export is best-effort and
never uploads an empty stub.
Require TE_COVERAGE=1 explicitly, cd into the output dir before
combining shards, pass TE_PATH/arch/suite into export metadata, and
document non-pytest python gaps in coverage-meta.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant