GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
openmp

OpenMP: Allow 'allocate' on target with user-defined allocator

Enables using user-defined allocators with the 'omp allocate' directive on targets.

This change enhances OpenMP’s support for memory management on targets by allowing the omp target directive to use a user-defined allocator. When the uses_allocators directive is used to define an allocator variable, the allocate clause on a target construct can now reference this variable, enabling more flexible device memory management.

In Details

This patch implements the omp target uses_allocators(traits(...): my_alloc) allocate(my_alloc:...) construct. It ensures that when allocate is used on a target and the specified allocator is a variable (defined via uses_allocators), the compiler correctly obtains the device representation of that allocator variable. This is crucial for using custom allocators on accelerator devices.

For Context
omp target
An OpenMP directive used to specify that a region of code or data should be executed or managed on a target device, such as a GPU.
uses_allocators
An OpenMP directive that allows a list of allocators to be used within a scope. It can be used to specify custom allocators for memory management.
allocate
An OpenMP clause that explicitly allocates memory for data associated with a target region or within a scope using a specified allocator.
value_expr
In the context of compiler intermediate representation, a value expression represents a computed value or a reference to a variable.
Filed Under: openmpcompilertarget deviceallocator