ci: code coverage for ROCm libraries (backup of #8656 @ a13f790f)#9199
Open
jainprad wants to merge 82 commits into
Open
ci: code coverage for ROCm libraries (backup of #8656 @ a13f790f)#9199jainprad wants to merge 82 commits into
jainprad wants to merge 82 commits into
Conversation
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.
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>
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 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 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
*This pull request uses carry forward flags. Click here to find out more. 🚀 New features to boost your workflow:
|
malcolmroberts
requested changes
Jul 10, 2026
malcolmroberts
left a comment
Contributor
There was a problem hiding this comment.
See comments on #9287
Why are there three PRs here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_COVERAGEgating; codecov flag and rocThrust SQLite fallback split into their own PRs) but before the 2026-07-08developmerge that pulled infeat(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
develop.Made with Cursor