Libgomp corrects USM global variable handling comment and adds test.
Fixes a comment in libgomp about Uniform Memory Access (USM) and adds a test case for global static variables within 'target' blocks.
This commit corrects a comment in libgomp regarding the handling of global static variables within ‘target’ structured blocks when Uniform Memory Access (USM) is enabled. The previous comment incorrectly stated that these variables would be address-translated, potentially causing issues. The compiler actually optimizes this by directly accessing the host variable, avoiding address translation. A new testcase verifies this correct behavior, addressing PR 127186.
In Details
The comment in libgomp/target.c for GOMP_target_ext regarding GOMP_RUNTIME_USM and global static variables within target blocks has been corrected. It previously suggested address translation issues, but the middle-end optimization directly accesses the host variable, eliminating the concern. A new test usm_env_handling-2.c is added to libgomp.c/ to confirm this correct behavior for PR 127186.
- libgomp
- GCC's runtime library for OpenMP, which supports parallel execution of C, C++, and Fortran programs.
- Uniform Memory Access (USM)
- A memory management feature in heterogeneous computing (like GPUs) that allows unified access to memory across the host and devices, simplifying memory handling.
- target block
- In OpenMP, a region of code marked with a
#pragma omp targetdirective, indicating that the code within should be executed on a target device (e.g., a GPU). - address translation
- The process of converting memory addresses from one space (e.g., virtual) to another (e.g., physical or device-specific). In this context, it refers to mapping host memory addresses to device memory addresses.