libgomp: Add Controls For Runtime USM
Introduces an environment variable to control Unified Shared Memory (USM) usage in libgomp.
Libgomp, the OpenMP runtime library, now offers control over Unified Shared Memory (USM) through the GOMP_RUNTIME_USM environment variable. This allows developers to explicitly enable, disable, or set USM to ‘auto’ mode, where it’s conditionally used for integrated GPUs. The change includes parsing logic for the environment variable, integration into the runtime initialization, and documentation updates. Verbose environment output also now reflects USM settings.
In Details
This commit adds runtime control for Unified Shared Memory (USM) in libgomp via the GOMP_RUNTIME_USM environment variable. The variable's values ('disabled', 'auto', 'enabled') dictate how libgomp interacts with memory paradigms. 'auto' specifically enables USM for integrated GPUs ('APU'). The changes span env.c for parsing, libgomp.h for definitions, libgomp.texi for documentation, and various target-specific files (oacc-init.c, target.c) to integrate USM capability checks and memory allocation logic. This impacts how OpenMP applications manage memory on devices that support USM.
- libgomp
- The GNU Offloading and Computational Acceleration Library, serving as the runtime support library for OpenMP in GCC.
- OpenMP
- A standardized API for shared-memory parallel programming. It consists of compiler directives, library routines, and environment variables.
- Unified Shared Memory (USM)
- A memory management feature in modern accelerators (like GPUs) that allows a single pointer to access both host (CPU) and device (GPU) memory seamlessly, simplifying data management for parallel applications.
- APU
- Accelerated Processing Unit, a term often used for processors that combine CPU cores with integrated GPU graphics on a single chip, common in laptops and some desktops.
- runtime
- The period during which a program is executing. The runtime library provides services and manages resources while the program is running.