gdb/testsuite/gdb.rocm: add OpenMP GPU offload tests#134
Draft
spatrang wants to merge 1 commit into
Draft
Conversation
Contributor
|
With flang-23 I get: |
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.
Summary
Add OpenMP GPU offload coverage to the
gdb.rocm/testsuite.The existing
gdb.rocm/tests cover HIP-style kernels (__global__functions launched via
hipLaunchKernelGGL), but there is no coveragefor OpenMP
targetoffload — an increasingly common way of programmingAMD GPUs from C, C++ and Fortran. Without these tests, regressions in
GDB's handling of:
__omp_offloading_<hash>_<func>_l<line>outliner-frame symbols,libomptargetplugins,not
libamdhip64),map-clause variables,can land silently while the HIP path keeps working.
Motivation
gdb.threads/already has CPU-side OpenMP tests (omp-par-scope.exp,omp-task.exp), but nothing in the testsuite exercises thetargetconstruct on an actual GPU. This PR adds those tests and the dejagnu
framework hooks needed to drive an OpenMP-offload-capable Clang/Flang
toolchain.
What changed
Framework hooks in
gdb/testsuite/lib/rocm.exp(+186 lines)Reusable procs that future OpenMP-offload tests can also rely on:
then `$ROCM_PATH/lib/llvm/bin`, then `PATH`.
wrappers for the three offload-capable compiler drivers.
`require`-compatible predicates: amd-dbgapi support, toolchain
availability, ≥ 1 AMD GPU.
`-fopenmp -fopenmp-targets=amdgcn-amd-amdhsa --offload-arch=…`
flag set; omits the Clang-only `-Wno-unused-command-line-argument`
for Fortran (the Flang driver rejects that diagnostic option).
`gdb_compile_omp_offload_fortran` — `gdb_compile` wrappers that
swap in the right offload-capable driver and add the offload flags.
OpenMP tests serialize with HIP tests on the GPU.
New tests under `gdb/testsuite/gdb.rocm/` (16 files)
`file:line`, AMDGPU wave check.
keeps the program on a wave.
`firstprivate` and a device-local automatic variable.
produces multiple AMDGPU waves at one breakpoint; `thread N`
switches to a wave; `print i` works inside it.
`target` regions; the device buffer is reused between kernels
(verified via `c[0] == 100` in the second kernel).
launched from separate target regions; named breakpoints land on the
right kernel.
struct functor (`multiplier::operator()`) compiled with the C++
driver; `print this->factor` works.
driver; breakpoint inside the loop hits an AMDGPU wave.
Each `.exp` follows the established `gdb.rocm/` patterns:
`load_lib rocm.exp`, `require allow_omp_offload_tests`,
`with_rocm_omp_gpu_lock { … }`, and uses the `gdb_test_multiple` +
`exp_continue` idiom (same as `gdb.rocm/shared-memory.exp`) so the
patterns survive multi-line GDB output.
Testing
```
make -C testsuite check TESTS="gdb.rocm/omp-target-*.exp"
…
of expected passes 47
of unexpected failures 0
```
Per-test PASS / FAIL counts:
On hosts without an offload-capable Clang/Flang toolchain or without an
AMD GPU, the `require allow_omp_offload_tests` /
`allow_omp_offload_fortran_tests` gates report the tests as
`UNSUPPORTED` rather than `FAIL`, so this PR is safe to land in CI
immediately.
Backwards compatibility
no signature changes. Existing HIP tests are unaffected.
`find_hipcc`) so there is no collision.