libgomp: Add tests for 'requires self_maps' with global static vars
Adds new test cases for OpenMP's 'requires self_maps' feature with global static variables.
This commit introduces several new test cases to the libgomp test suite to specifically target the behavior of OpenMP’s ‘requires self_maps’ clause when used in conjunction with global static variables. One of these tests (usm_env_handling-1-self.c) is marked as xfailed due to a segfault observed during compilation with NVPTX offloading and optimization level -O1, with the issue tracked in a separate bug report (PR target/127273).
In Details
PR libstdc++/122205 required adding tests for OpenMP 5.1's requires self_maps clause, particularly concerning its interaction with global static variables. This commit adds new test files like usm_env_handling-1-self.c to libgomp/testsuite. Notably, usm_env_handling-1-self.c fails to compile on nvptx targets with LTO enabled (lto1), exhibiting a segfault under -fopenmp -O1, which is noted as a known issue tracked in PR target/127273.
- libgomp
- GCC's implementation of the OpenMP shared-memory parallel programming model. It provides runtime support for OpenMP directives.
- OpenMP
- A standard API for supporting shared-memory parallel programming in C, C++, and Fortran. It consists of compiler directives, library routines, and environment variables.
- requires self_maps
- An OpenMP clause that specifies requirements for Unified Shared Memory (USM) memory management, indicating that the target device can map host memory directly.
- global static vars
- Variables declared at global scope with the 'static' keyword. They have static storage duration and internal linkage, meaning they are initialized once and only accessible within the translation unit where they are defined.
- USM
- Unified Shared Memory, a feature in some accelerator programming models (like OpenMP offloading) that allows a single memory address space accessible from both the host and the device.
- NVPTX
- NVIDIA's Parallel Thread Execution instruction set architecture, used for programming NVIDIA GPUs.
- LTO
- Link-Time Optimization, an optimization technique where the compiler performs optimizations across different source files during the linking stage, potentially leading to better overall code.