Skip to content

ci: add code coverage for header-only ROCm libraries (rocPRIM/hipCUB/rocThrust)#9287

Open
jainprad wants to merge 87 commits into
developfrom
users/jainprad/codecoverage_lib_header_only
Open

ci: add code coverage for header-only ROCm libraries (rocPRIM/hipCUB/rocThrust)#9287
jainprad wants to merge 87 commits into
developfrom
users/jainprad/codecoverage_lib_header_only

Conversation

@jainprad

Copy link
Copy Markdown

Summary

Enables code-coverage CI for the header-only libraries — rocPRIM, hipCUB, rocThrust — split out from the shared-object coverage work (hipRAND/rocRAND/rocFFT/rocBLAS, tracked in #8656). Header-only libraries have no shared object to instrument, so coverage is collected from their instrumented test binaries.

Branched from the coverage infrastructure (following #9221's users/<user>/…develop convention) and scoped to the header-only components.

Changes

  • .github/scripts/therock_configure_coverage.py: coverage matrix = rocPRIM / hipCUB / rocThrust (PRIM group), each with a per-project coverage_config path.
  • Per-project test_categories_coverage.yaml under each project's test/ dir (test-binary name prefixes); the combined root file is removed and export_coverage_metadata.py now reads the flat per-project file.
  • .github/workflows/therock-ci-coverage.yml: the report step passes the staged instrumented test binaries (coverage-objects/test/*) to llvm-cov as -object; coverage_config is threaded through the matrix.
  • projects/rocthrust/cmake/Dependencies.cmake: fall back to the bundled SQLite when the system package is unsuitable (TheRock coverage builds report SQLite version "unknown"), so the PRIM-group configure step does not hard-fail.
  • codecov.yml: add the rocPRIM flag.

Test plan

  • Coverage (rocPRIM / hipCUB / rocThrust) build → test → report jobs pass
  • Report artifacts generated with non-zero coverage per component
  • Coverage uploaded to Codecov under flags rocPRIM / hipCUB / rocThrust

Header-only test-binary coverage is a new flow; it needs a CI run to validate end-to-end.

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 5 commits July 8, 2026 16:13
…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>
…cThrust)

Header-only libraries have no shared object to instrument, so coverage is
collected from their instrumented test binaries. Split out from the
shared-object coverage work so it can be developed independently.

- therock_configure_coverage.py: activate rocPRIM/hipCUB/rocThrust (PRIM group),
  each with a per-project coverage_config path.
- Per-project test_categories_coverage.yaml under each project's test/ dir
  (test_binaries prefixes); drop the combined root file. export_coverage_metadata.py
  now reads the flat per-project file.
- therock-ci-coverage.yml: pass the instrumented test binaries (staged under
  coverage-objects/test) to llvm-cov as -object; thread coverage_config through
  the matrix.
- rocThrust: fall back to the bundled SQLite when the system package is
  unsuitable (TheRock coverage builds report SQLite version "unknown"), so the
  PRIM-group configure step does not hard-fail.
- codecov.yml: add the rocPRIM flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jainprad jainprad requested review from a team as code owners July 10, 2026 17:38
jainprad added a commit to jainprad/rocm-libraries that referenced this pull request Jul 10, 2026
…ents only

Header-only coverage (rocPRIM/hipCUB/rocThrust) is split into its own PR
(users/jainprad/codecoverage_lib_header_only -> develop, ROCm#9287). Remove it here:
- the disabled header-only metadata dict in therock_configure_coverage.py
- the *_ENABLE_COVERAGE options + instrumentation blocks in the rocPRIM/hipCUB/
  rocThrust CMakeLists (pre-existing BUILD_CODE_COVERAGE/CODE_COVERAGE untouched)

This PR now covers only the shared-object components: hipRAND, rocRAND, rocFFT,
rocBLAS.

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.

jainprad added a commit to jainprad/rocm-libraries that referenced this pull request Jul 10, 2026
The prior cleanup deleted the pre-existing if(BUILD_CODE_COVERAGE) /
if(CODE_COVERAGE) instrumentation blocks instead of only reverting the
<PROJECT>_ENABLE_COVERAGE guard rename, so the PR still modified these files.
Restore all three to develop verbatim so this PR does not touch the header-only
projects at all (they live in ROCm#9287).

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

@malcolmroberts malcolmroberts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes variables in the fft libraries, so the title doesn't match.

Also, we already had a cmake variable for doing code coverage; there is no reason for this to change; please revert.

@malcolmroberts

Copy link
Copy Markdown
Contributor

@jainprad - could you please add your name to your github account? It's hard to figure out who to talk to about these things.

This PR is scoped to the header-only libraries (rocPRIM / hipCUB / rocThrust).
Restore the shared-object components' CMakeLists (hipRAND / rocRAND / rocFFT /
rocBLAS) to develop verbatim so they are not part of this PR - they are covered
in the shared-object PR (#8656).

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

codecov-commenter commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (76.92%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9287      +/-   ##
===========================================
- Coverage    64.99%   64.84%   -0.15%     
===========================================
  Files         2685     2685              
  Lines       422111   422132      +21     
  Branches     62707    62702       -5     
===========================================
- Hits        274339   273722     -617     
- Misses      127073   127785     +712     
+ Partials     20699    20625      -74     
Flag Coverage Δ *Carryforward flag
TensileLite 34.85% <ø> (-0.01%) ⬇️ Carriedforward from c91ea9e
hipBLAS 90.81% <ø> (ø) Carriedforward from c91ea9e
hipBLASLt 34.71% <ø> (ø) Carriedforward from c91ea9e
hipCUB 82.68% <ø> (ø) Carriedforward from c91ea9e
hipDNN 86.15% <ø> (ø) Carriedforward from c91ea9e
hipFFT 50.10% <ø> (-0.78%) ⬇️ Carriedforward from c91ea9e
hipRAND 76.12% <ø> (ø)
hipSOLVER 69.18% <ø> (ø) Carriedforward from c91ea9e
hipSPARSE 86.10% <ø> (ø) Carriedforward from c91ea9e
rocBLAS 47.92% <ø> (+0.01%) ⬆️
rocFFT 48.96% <ø> (-1.84%) ⬇️
rocRAND 57.03% <ø> (+0.01%) ⬆️
rocSOLVER 76.92% <ø> (ø) Carriedforward from c91ea9e
rocSPARSE 72.37% <ø> (ø) Carriedforward from c91ea9e
rocThrust 91.36% <ø> (ø) Carriedforward from c91ea9e

*This pull request uses carry forward flags. Click here to find out more.
see 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

5 participants