libgomp: Add by-device capabilities for OpenMP 'omp requires' handling
OpenMP device capabilities become more granular, allowing for specific by-device settings.
Libgomp now supports setting OpenMP device capabilities on a per-device basis, rather than just a generic type. This allows finer control, such as enabling unified-shared memory (USM) only for specific devices like integrated GPUs (APUs). The change moves requirement handling back to target.c and improves OpenMP offloading for USM on appropriate hardware.
In Details
Previously, libgomp's offload plugins reported generic by-device-type capabilities. This commit introduces GOMP_OFFLOAD_CAP_APU_SHARED_MEM and GOMP_OFFLOAD_CAP_UNIFIED_ADDR to denote per-device, fine-grained capabilities. This enables new logic in target.c to specifically enable unified_shared_memory for devices identified as APUs supporting USM, and to more accurately filter devices based on host memory access support (e.g., pageableMemoryAccess for NVIDIA, SVM_ACCESSIBLE_BY_DEFAULT or APU-specific checks for AMD).
- libgomp
- GCC's implementation of the OpenMP runtime library, responsible for managing parallel execution of OpenMP directives.
- OpenMP
- An API for shared-memory parallel programming that consists of compiler directives, library routines, and environment variables.
- unified_shared_memory
- A feature in OpenMP that allows host and device to access the same memory region without explicit data transfers, simplifying memory management in heterogeneous computing.
- APU
- Accelerated Processing Unit, a type of processor that combines CPU cores with integrated GPU cores on a single die. In this context, it refers to integrated GPUs that may support unified shared memory.
- USM
- Unified Shared Memory. See
unified_shared_memory. - HSA
- Heterogeneous System Architecture. A standard that aims to provide a common platform for programming diverse hardware accelerators, including GPUs.
- XNACK
- Attribute for AMD GPUs indicating whether system (host) memory can be accessed by the GPU. It relates to security and coherent memory access.