Skip to content

ci(coverage): Codecov integration (codecov.yml + upload tooling)#9288

Open
jainprad wants to merge 86 commits into
developfrom
users/jainprad/codecoverage_codecov_tool
Open

ci(coverage): Codecov integration (codecov.yml + upload tooling)#9288
jainprad wants to merge 86 commits into
developfrom
users/jainprad/codecoverage_codecov_tool

Conversation

@jainprad

Copy link
Copy Markdown

Summary

Dedicated PR for the Codecov integration, split out from the coverage-generation work per review feedback (reboss: keep codecov config + upload tooling separate).

This PR owns:

  • codecov.yml — the per-component flag/target configuration.
  • The "Upload coverage to Codecov" step in therock-ci-coverage.yml — installs codecovcli and uploads the LCOV report (token for non-fork/postsubmit; tokenless owner:branch path for fork PRs). Adds the required --git-service github so the tokenless upload completes (without a token codecovcli cannot infer the git provider → "Upload service is missing").

Branched from the coverage infrastructure (following #9221's users/<user>/…develop convention), so it runs standalone.

Relationship to the other coverage PRs

Follow-up (separate, reboss #470)

Baking codecov-cli into the build container (instead of pip install at runtime) is a TheRock container change and will be handled separately (cc @geomin12).

Test plan

  • Coverage jobs upload LCOV to Codecov under the correct flags
  • Tokenless upload succeeds for fork PRs; token used for same-repo/postsubmit

Made with Cursor

Made with Cursor

reboss added 30 commits May 22, 2026 15:32
The current therock_configure_ci.py doesn't have a clean way to only
configure the project that has changed, and not other components that
the changed component has been grouped together with.  For code coverage
reports, it does not make sense to even test downstream components.
jainprad and others added 13 commits June 29, 2026 05:10
rocSPARSE coverage cannot build: enabling SPARSE pulls in the PRIM group,
whose rocThrust configure fails on find_package(SQLite3 3.51.3) because the
sysdeps-provided SQLite3 reports an unknown version. This is an upstream
rocThrust/TheRock dependency issue, so remove the rocSPARSE coverage
component (metadata, YAML entry, and CMake alias) until it is resolved.
rocBLAS coverage is unaffected and retained.

Co-authored-by: Cursor <cursoragent@cursor.com>
coverage_runner.py now skips report generation when a build produced no
profraw, so no coverage.info is written. The downstream report bash runs
under 'set -euo pipefail', where expanding the resulting empty SOURCES /
OBJECTS arrays tripped 'unbound variable' and failed the job. Short-circuit
the step with a clean exit 0 when coverage.info is absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
Header-only libraries have no shared object to instrument, so coverage is
collected from their instrumented test binaries (all three add
-fprofile-instr-generate/-fcoverage-mapping to the tests under their
coverage flag). Changes:

- CMake aliases ROCPRIM/HIPCUB/ROCTHRUST_ENABLE_COVERAGE mapping onto each
  project's BUILD_CODE_COVERAGE / CODE_COVERAGE option.
- COVERAGE_PROJECT_METADATA + YAML entries (test_binaries name prefixes)
  and a rocPRIM codecov flag.
- export_coverage_metadata.py resolves the instrumented test executables
  (ELF, scoped to the component build subdir, extension/CMakeFiles filtered)
  and stages them into coverage-objects so the report job can pass them to
  llvm-cov; coverage_runner.py already resolves them.
- report step includes staged test binaries and guards empty arrays under
  set -u.

Also make rocThrust resilient to a missing/mis-versioned system SQLite3 by
falling back to its bundled download (find_package no longer REQUIRED).
Without this the PRIM group coverage build fails at find_package(SQLite3
3.51.3) against TheRock's sysdeps SQLite3 (version "unknown") - the same
issue that blocked rocSPARSE.

Co-authored-by: Cursor <cursoragent@cursor.com>
rocPRIM's tests build in a dedicated TheRock subproject ("rocPRIM_tests"),
so the exact path-part scope match found no rocprim test binaries and the
report failed with "No coverage object files could be resolved". Match the
component build subdir as a substring of a path part so "<target>_tests"
subprojects are scoped correctly, while still excluding sibling components
in the shared PRIM build.

Co-authored-by: Cursor <cursoragent@cursor.com>
Review feedback (reboss): aliasing the standardized <PROJECT>_ENABLE_COVERAGE
flag onto the shared BUILD_CODE_COVERAGE / CODE_COVERAGE / ROCBLAS_BUILD_COVERAGE
switches risks inadvertently instrumenting other components. Instead, gate each
project's instrumentation directly on its own <PROJECT>_ENABLE_COVERAGE (OR'd
with the project's legacy local switch) and stop toggling the shared variables,
matching the existing hipRAND/hipDNN convention.

rocFFT additionally guards its -fgpu-rdc opt-out on ROCFFT_ENABLE_COVERAGE so a
coverage build still disables relocatable device code.

Co-authored-by: Cursor <cursoragent@cursor.com>
Per review feedback, the codecov.yml rocPRIM flag and the rocThrust SQLite3
fallback are out-of-scope for this PR. They now live in their own PRs:
- codecov rocPRIM flag: #8955
- rocThrust SQLite fallback: #8956

Note: the header-only (PRIM group) coverage build here depends on #8956
landing so rocThrust configure does not fail on find_package(SQLite3).

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the legacy BUILD_CODE_COVERAGE / CODE_COVERAGE conditions from the
instrumentation guards; the standardized <PROJECT>_ENABLE_COVERAGE flag is the
only switch needed to instrument each component.

Co-authored-by: Cursor <cursoragent@cursor.com>
…st guard

Review feedback (reboss) on the coverage flow:

- Inline the coverage report generation (llvm-profdata merge + llvm-cov
  report/show/export) directly in the report step of therock-ci-coverage.yml
  instead of calling the coverage_runner.py wrapper (which was only ever run
  with --skip-tests). coverage_runner.py is kept in-tree but unused for now.
- Disable the header-only components (rocPRIM/hipCUB/rocThrust) rather than
  removing them: their metadata moves to a disabled dict in
  therock_configure_coverage.py and their YAML entries are marked
  enabled: false, so no coverage jobs are emitted while the flow is limited to
  shared-object components. Config is retained for easy re-enable.
- Restore the gfx950-dcgpu test skip guard in therock-ci-linux.yml that was
  removed by accident, and drop a stray blank line.
- Drop the noisy ls/ldd diagnostics from the llvm-tool staging step.

Deferred (need TheRock-side support / cross-team design, per review):
- Fetching llvm-profdata/llvm-cov via FETCH_ARTIFACT_ARGS (amd-llvm) instead of
  staging/uploading them.
- Moving to per-project test_categories_*.yaml and reusing TheRock's
  test_runner.py (reworking export_coverage_metadata.py accordingly).

Co-authored-by: Cursor <cursoragent@cursor.com>
…erage_lib_v2

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	.github/workflows/therock-test-component.yml
#	projects/rocfft/CMakeLists.txt
The develop merge pulled in "feat(rocrand): use primbench (#4454)", whose
benchmark unconditionally links amd_smi and includes <amd_smi/amdsmi.h> on
Linux. Narrowed builds that do not stage the amd-smi dev headers (e.g. the
code-coverage builds, which enable only RAND/FFT) then fail to compile the
rocRAND benchmark, which cascades to skipped test/report jobs so no profraw
or coverage report is produced for hipRAND/rocRAND/rocFFT.

Detect the amd-smi dev header and only enable monitoring (link amd_smi) when
present; otherwise build the benchmark with PRIMBENCH_NO_MONITORING. This
matches primbench's own soft-dependency design and keeps full builds
(header present) unchanged while unblocking the coverage builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Dedicated PR for the Codecov tooling, split out from the coverage-generation
work per review (reboss). Owns codecov.yml (flags/targets) and the
"Upload coverage to Codecov" step. Adds the required --git-service github so the
tokenless upload path completes (without a token codecovcli cannot infer the git
provider and fails with "Upload service is missing").

Co-authored-by: Cursor <cursoragent@cursor.com>
@jainprad jainprad requested review from a team as code owners July 10, 2026 19:47
jainprad added a commit to jainprad/rocm-libraries that referenced this pull request Jul 10, 2026
Per review, the Codecov config + upload tooling now live in a dedicated PR
(users/jainprad/codecoverage_codecov_tool, ROCm#9288). Remove the "Upload coverage
to Codecov" step here; this PR builds, tests, and produces the coverage report
artifact only. The job summary points to the Codecov PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
@therock-pr-bot

therock-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

✅ All Checks Passed — Ready for Review

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled
🤖 therock-pr-bot ✅ Pass

🎉 All checks passed! This PR is ready for review.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🎉 All checks passed! This PR is ready for review.

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.

3 participants