llvm-project
3075f11c - [Offload][OpenMP] Report source location of data transfers and synchr… (#232438)

Commit
10 days ago
[Offload][OpenMP] Report source location of data transfers and synchr… (#232438) …onization (Repush of https://github.com/llvm/llvm-project/pull/223730 updated private.h to still print synchronization line even if debug info is not available, before if it wasent the line was skipped causing the force-usm test to fail.) This PR improves `LIBOMPTARGET_INFO` diagnostics so data-transfer and synchronization messages carry a source location, and so runtime-internal transfers show a meaningful name instead of `unknown`. ### Changes - Thread the region's source location (`ident_t *Loc`) through the submit/retrieve/copy-info paths and append `, at <file>:<line>:<col>` to "Copying data…" messages (emitting nothing when no location is available, avoiding `unknown:0:0`). - Emit a new `Waiting for asynchronous operations to complete` message, with source location, before the runtime synchronizes. - Add an optional name for runtime-internal transfers so they report `DeviceEnvironment` / `IndirectCallTable` instead of `unknown`. ### Effect Given a simple `target map(tofrom: value)` region: ``` fortran program omp_target_map_test implicit none integer :: value value = 0 !$omp target map(tofrom: value) value = 1 !$omp end target print *, value if (value /= 1) then stop 1 end if end program omp_target_map_test ``` ``` bash Copying data from host to device, ... Name=DeviceEnvironment Copying data from host to device, ... Name=value, at test.f90:7:7 Copying data from device to host, ... Name=value, at test.f90:7:7 Waiting for asynchronous operations to complete at test.f90:7:7 ``` The `, at test.f90:7:7` suffixes only appear when [llvm/llvm-project#222389](https://github.com/llvm/llvm-project/pull/222389) is also present — that change supplies the source-location argument from the front end into the runtime. Without it, the transfers still print (and internal transfers are still named), just without the location suffix. ### Tests Updated `offload/test/offloading/info.c` and `offload/test/offloading/force-usm.cpp` to check the location suffix, the new synchronization message, and the named internal transfer. I did not create an RFC for these changes as my original goal was to simply fix / remove the unknown file line info in the debug outputs, but If desired I can create one for this PR for the expanded functionality that this change presents Assisted-by: Opus 4.8
Parents
Loading