Skip to content

ci: code coverage for ROCm libraries (backup of #8656 @ a13f790f)#9199

Open
jainprad wants to merge 82 commits into
ROCm:developfrom
jainprad:users/jainprad/pr8656-backup-a13f790f
Open

ci: code coverage for ROCm libraries (backup of #8656 @ a13f790f)#9199
jainprad wants to merge 82 commits into
ROCm:developfrom
jainprad:users/jainprad/pr8656-backup-a13f790f

Conversation

@jainprad

@jainprad jainprad commented Jul 8, 2026

Copy link
Copy Markdown

Purpose

Backup/snapshot of #8656 at commit a13f790f762f75e15df823daa90c14ea4408e0db (2026-06-30, "gate coverage solely on <PROJECT>_ENABLE_COVERAGE").

This preserves the coverage work after incorporating the first round of review feedback (native <PROJECT>_ENABLE_COVERAGE gating; codecov flag and rocThrust SQLite fallback split into their own PRs) but before the 2026-07-08 develop merge that pulled in feat(rocrand): use primbench (#4454) and destabilized the RAND/FFT coverage builds.

Opened purely as a safe, referenceable copy — not intended for merge. Active development continues on #8656.

Notes

  • Branch is at the Jun 30 snapshot, so it is behind develop.
  • Covers hipRAND, rocRAND, rocFFT, rocBLAS (shared-object) coverage plus the (then-enabled) header-only rocPRIM/hipCUB/rocThrust support.

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 9 commits June 28, 2026 17:39
These coverage scripts predated the black pre-commit hook enforcement and
were failing it; reformat to satisfy the hook.

Co-authored-by: Cursor <cursoragent@cursor.com>
GPU families whose test machines lack a matching GPU run only host-side
quick tests that never exercise the instrumented library, so they upload
no profraw (e.g. rocRAND/hipRAND/rocBLAS on gfx94X). With nothing to
merge, treat it as a no-op success and skip the report instead of failing
the whole coverage job; families that do produce profraw (gfx950) still
generate and upload reports.

Co-authored-by: Cursor <cursoragent@cursor.com>
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: ROCm#8955
- rocThrust SQLite fallback: ROCm#8956

Note: the header-only (PRIM group) coverage build here depends on ROCm#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>
@therock-pr-bot

therock-pr-bot Bot commented Jul 8, 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

therock-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

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

Only rocBLAS currently builds and produces a coverage report. After the
develop merge pulled in the primbench benchmark (which includes
<amd_smi/amdsmi.h> and does not compile in the coverage build), the
Build Coverage stage fails for every other component (hipRAND, rocRAND,
rocFFT, rocPRIM, hipCUB, rocThrust). Trim the PR to just the working
rocBLAS shared-object coverage:

- therock_configure_coverage.py: drop the six entries from
  COVERAGE_PROJECT_METADATA (the coverage job matrix is generated from it),
  leaving only rocblas.
- test_categories_coverage.yaml: drop the six project configs, leaving only
  rocblas.
- revert each removed component's CMakeLists.txt coverage instrumentation
  back to develop (its <PROJECT>_ENABLE_COVERAGE gating and the hipRAND
  llvm-tool hints), so those files are no longer touched by this PR.

Shared coverage infrastructure (workflows, coverage_runner.py,
export_coverage_metadata.py) and codecov.yml are unchanged.

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

codecov-commenter commented Jul 9, 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    #9199      +/-   ##
===========================================
+ Coverage    64.75%   65.08%   +0.33%     
===========================================
  Files         2685     2683       -2     
  Lines       422105   421735     -370     
  Branches     62708    62678      -30     
===========================================
+ Hits        273333   274468    +1135     
+ Misses      128148   126601    -1547     
- Partials     20624    20666      +42     
Flag Coverage Δ *Carryforward flag
TensileLite 34.84% <ø> (ø) Carriedforward from b0a66ab
hipBLAS 90.81% <ø> (ø) Carriedforward from b0a66ab
hipBLASLt 34.71% <ø> (ø) Carriedforward from b0a66ab
hipCUB 82.68% <ø> (ø)
hipDNN 86.15% <ø> (ø) Carriedforward from b0a66ab
hipFFT 50.10% <ø> (ø) Carriedforward from b0a66ab
hipRAND 76.12% <ø> (ø)
hipSOLVER 69.18% <ø> (ø) Carriedforward from b0a66ab
hipSPARSE 86.10% <ø> (ø) Carriedforward from b0a66ab
rocBLAS 48.06% <ø> (+0.15%) ⬆️ Carriedforward from b0a66ab
rocFFT 51.68% <ø> (+3.85%) ⬆️
rocRAND 57.03% <ø> (+0.01%) ⬆️
rocSOLVER 76.92% <ø> (ø) Carriedforward from b0a66ab
rocSPARSE 72.37% <ø> (ø) Carriedforward from b0a66ab
rocThrust 91.35% <ø> (-0.01%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.
see 86 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.

@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.

See comments on #9287

Why are there three PRs here?

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.

4 participants