Skip to content

ci: code coverage for ROCm libraries (backup of #9199 @ b0a66ab)#9216

Open
jainprad wants to merge 81 commits into
ROCm:developfrom
jainprad:users/jainprad/pr9199-backup-b0a66ab
Open

ci: code coverage for ROCm libraries (backup of #9199 @ b0a66ab)#9216
jainprad wants to merge 81 commits into
ROCm:developfrom
jainprad:users/jainprad/pr9199-backup-b0a66ab

Conversation

@jainprad

@jainprad jainprad commented Jul 9, 2026

Copy link
Copy Markdown

Purpose

Backup/snapshot of #9199 at commit b0a66ab18e353f452029259afbb445808e061ac0 (2026-07-08, "Merge branch 'develop' into users/jainprad/pr8656-backup-a13f790f").

This captures the coverage work at the point where develop was merged into the #9199 branch — the merge that pulled in feat(rocrand): use primbench (#4454). It preserves that exact state before any fixes for the resulting RAND/FFT/PRIM coverage build failures.

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

Notes

  • Branch points at the exact ci: code coverage for ROCm libraries (backup of #8656 @ a13f790f) #9199 HEAD (b0a66ab), so it is behind develop.
  • Covers hipRAND, rocRAND, rocFFT, rocBLAS (shared-object) coverage plus header-only rocPRIM/hipCUB/rocThrust support.
  • Known-failing at this snapshot: the Build Coverage jobs for HIPCUB / HIPRAND / ROCFFT / ROCPRIM / ROCRAND / ROCTHRUST fail because the merged-in primbench benchmark (shared/primbench/primbench.hpp) includes amd_smi/amdsmi.h, which is not available in the coverage build environment.

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 28, 2026 16:51
Co-authored-by: Cursor <cursoragent@cursor.com>
The COVERAGE_PROJECT_METADATA entries exceeded black's line length, which
was failing the pre-commit black hook. Wrap them to satisfy formatting.

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

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

# Conflicts:
#	projects/rocfft/CMakeLists.txt
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 9, 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 9, 2026

Copy link
Copy Markdown

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

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

3 participants