[Flang][OpenMP] Expand end-to-end DO CONCURRENT device test coverage
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
### Summary
Expand end-to-end device testing for Flang's `DO CONCURRENT` to OpenMP conversion.
`offload/test/offloading/fortran` currently holds three end-to-end `DO CONCURRENT` tests:
- [one-dimensional SAXPY](https://github.com/llvm/llvm-project/blob/6120eb5267a8643dd399f8858b6c92f23a846551/offload/test/offloading/fortran/do-concurrent-to-omp-saxpy.f90)
- [two-dimensional SAXPY](https://github.com/llvm/llvm-project/blob/6120eb5267a8643dd399f8858b6c92f23a846551/offload/test/offloading/fortran/do-concurrent-to-omp-saxpy-2d.f90)
- [one `MIN` reduction](https://github.com/llvm/llvm-project/blob/6120eb5267a8643dd399f8858b6c92f23a846551/offload/test/offloading/fortran/do-concurrent-to-omp-min-reduce.f90)
FIR-to-OpenMP conversion tests cover more forms, including additive reductions. Those tests do not prove that device compilation, linking, execution, and result transfer succeed together.
### Proposed coverage
Add small end-to-end tests for these application-derived patterns:
- scalar additive `REDUCE`.
- multiple additive reduction variables in one loop.
- an inner additive reduction nested inside an outer `DO CONCURRENT`.
- a call to a module `PURE` procedure from a device-converted loop.
- a `PURE` function that accepts and returns a simple derived type inside a loop over an array of that type.
Each test should run on the device and check its result. Setting `OMP_TARGET_OFFLOAD=MANDATORY` prevents host fallback. The existing tests also check `LIBOMPTARGET_INFO` output to confirm a kernel launch, and the new tests can follow that pattern.
### Motivation
The POT3D benchmark studied in [Portability of Fortran's `do concurrent` on GPUs II](https://arxiv.org/abs/2608.20586) uses additive reductions, multiple reduction variables, and nested inner reductions. The paper names procedure calls and derived types as important patterns in MAS, the larger application it plans to study next.
Standalone programs for all five patterns ran on an AMD MI100 with `OMP_TARGET_OFFLOAD=MANDATORY`, using Flang 24.0.0git at `00890d9f885989008a8cb5cf5f5335f6f385dbd4`. Each program offloaded and produced the expected result.
Upstream tests would guard that behavior against regressions and add application-motivated coverage. They would not pull in POT3D's MPI and HDF5 dependencies.
Contributor guide
Research direction
Start by reading the existing tests in offload/test/offloading/fortran, especially do-concurrent-to-omp-saxpy.f90, do-concurrent-to-omp-saxpy-2d.f90, and do-concurrent-to-omp-min-reduce.f90. Follow their device execution and LIBOMPTARGET_INFO checks while adding coverage for the five listed reduction, procedure-call, and derived-type patterns. Done means each test runs with OMP_TARGET_OFFLOAD=MANDATORY, confirms a kernel launch, and checks the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fortran
- Domain
- compilers, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100