Skip to content

[smoke-dev] Add HipDevCov and OmpDevCov device-coverage drain tests#2311

Merged
lfmeadow merged 2 commits into
aomp-devfrom
dev-cov-smoke-tests
Jun 29, 2026
Merged

[smoke-dev] Add HipDevCov and OmpDevCov device-coverage drain tests#2311
lfmeadow merged 2 commits into
aomp-devfrom
dev-cov-smoke-tests

Conversation

@lfmeadow

Copy link
Copy Markdown
Contributor

Summary

Adds two test/smoke-dev tests that validate device-side PGO/coverage drainage via the in-tree HSA-introspection drain (upstream LLVM #203056), independent of the HIP host-shadow drain.

  • HipDevCov — Builds a device-only kernel as a full executable so the device link pulls in the amdgcn profile runtime, extracts its code object (mod.co) via llvm-objdump --offloading, then hipModuleLoad()s it from a program where that kernel has no host shadow. Its counters can only reach the merged profile through the HSA drain. The test asserts both the host-shadow kernel and the module-only kernel are present (and intentionally does not unload the module, since the HSA drain runs at process exit on still-loaded code objects).
  • OmpDevCov — OpenMP target offload has no host-shadow drain, so a -fprofile-generatellvm-profdata merge-fprofile-use round trip that consumes a device function's counters exercises the HSA drain exclusively.

Both tests honor $AOMP/$AOMP_GPU, use the existing smoke-dev Makefile.defs/Makefile.rules harness, set a 300s timeout, and skip cleanly on toolchains that do not yet ship the device profile runtime / HSA drain (so they won't red-fail CI before the drain lands in the bundled LLVM).

Test plan

  • make checkTEST_STATUS=0 for both dirs on a gfx90a (MI210) box, using a toolchain containing the OpenMP runtime + device profile RT + HSA drain.
  • HipDevCov: merged profile contains both host_kernel (host-shadow) and mod_kernel (HSA-only; gfx90a.hsa0.*.profraw produced).
  • OmpDevCov: amdgcn-amd-amdhsa.*.profraw drained via HSA; FileCheck finds classify/__omp_offloading_; -fprofile-use rebuild consumes cleanly and runs.
  • Verify under AOMP nightly once #203056 is in the bundled LLVM (until then the tests skip).

Made with Cursor

Add two smoke-dev tests that validate device-side PGO/coverage drainage via
the in-tree HSA-introspection drain (upstream LLVM #203056), independent of the
HIP host-shadow drain.

HipDevCov: builds a device-only kernel as an executable so the device link
pulls in the amdgcn profile runtime, extracts its code object (mod.co) via
llvm-objdump --offloading, then hipModuleLoad()s it from a program where that
kernel has no host shadow. The kernel's counters can only reach the merged
profile through the HSA drain; the test asserts both the host-shadow kernel and
the module-only kernel are present.

OmpDevCov: OpenMP target offload has no host-shadow drain, so a
-fprofile-generate -> llvm-profdata merge -> -fprofile-use round trip that
consumes a device function's counters exercises the HSA drain exclusively.

Both honor $AOMP/$AOMP_GPU, use the smoke-dev Makefile harness, and skip
cleanly on toolchains that do not yet ship the device profile runtime / drain.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the ls|head pipeline used to find the extracted device code object
with a nullglob array, satisfying aomp-lint shellcheck.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lfmeadow lfmeadow merged commit 3f996c0 into aomp-dev Jun 29, 2026
1 check passed
@lfmeadow lfmeadow deleted the dev-cov-smoke-tests branch June 29, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants