OpenMP: Implement 'link' behavior for maps under 'requires self_maps'
OpenMP now correctly implements 'link' behavior for 'enter' maps when 'requires self_maps' or 'unified_shared_memory' is active.
This change ensures that OpenMP’s ‘enter’ map clauses behave as ‘link’ when the requires self_maps or unified_shared_memory directives are in effect. During implicit declare-target discovery for global variables, existing omp declare target attributes are now transformed into omp declare target link. This aligns the behavior with the specified requirements for self-mapping and unified shared memory, improving the correctness of offload operations.
In Details
Implements 'link' clause behavior for OpenMP 'enter' maps when OMP_REQUIRES_SELF_MAPS or OMP_REQUIRES_UNIFIED_SHARED_MEMORY is active. Transforms implicit omp declare target directives into omp declare target link during omp_discover_implicit_declare_target to satisfy these requirements.
- OpenMP
- A standardized API for shared-memory parallel programming. It uses directives and clauses to specify parallelism, data sharing, and offload behavior.
- map clause
- An OpenMP clause used to specify how data associated with a construct should be mapped to the target device, including its lifetime and scope (e.g., to, from, enter, exit, link).
- requires self_maps
- An OpenMP clause indicating that the target device can access host memory directly, implying that explicit data movement is not always necessary for mapped variables.
- unified_shared_memory
- An OpenMP clause indicating that the target system provides a unified memory space accessible from both the host and the device, simplifying data management for offload operations.
- declare target
- An OpenMP directive used to specify that a variable or function should be mapped to or accessible on a target device for offload computations.
- declare target link
- An OpenMP directive that marks a variable or function for implicit mapping and potentially shared lifetime across offload regions, particularly when self-maps or unified memory are enabled.