LLVM OpenMP 22.0.0git
kmp_tgt_allocator_t Class Reference

Support OMP 6.0 target memory management Expected offload runtime entries. More...

Public Member Functions

void init ()
 Initialize interface with offload runtime.
int get_mem_resources (int ndevs, const int *devs, int host, omp_memspace_handle_t memspace, int *resources)
 Obtain resource information from offload runtime.
voidomp_alloc (size_t size, omp_allocator_handle_t allocator)
 Invoke offload runtime's memory allocation routine.
void omp_free (void *ptr, omp_allocator_handle_t allocator)
 Invoke offload runtime's memory deallocation routine.

Detailed Description

Support OMP 6.0 target memory management Expected offload runtime entries.

Returns number of resources and list of unique resource IDs in "resouces". Runtime needs to invoke this twice to get the number of resources, allocate space for the resource IDs, and finally let offload runtime write resource IDs in "resources". int __tgt_get_mem_resources(int num_devices, const int *devices, int host_access, omp_memspace_handle_t memspace, int *resources);

Redirects omp_alloc call to offload runtime. void *__tgt_omp_alloc(size_t size, omp_allocator_handle_t allocator);

Redirects omp_free call to offload runtime. void __tgt_omp_free(void *ptr, omp_allocator_handle_t);

Definition at line 1301 of file kmp_alloc.cpp.

Member Function Documentation

◆ get_mem_resources()

int kmp_tgt_allocator_t::get_mem_resources ( int ndevs,
const int * devs,
int host,
omp_memspace_handle_t memspace,
int * resources )
inline

Obtain resource information from offload runtime.

We assume offload runtime backends maintain a list of unique resource IDS.

Definition at line 1322 of file kmp_alloc.cpp.

◆ init()

void kmp_tgt_allocator_t::init ( )
inline

Initialize interface with offload runtime.

Definition at line 1313 of file kmp_alloc.cpp.

References KMP_DLSYM.

◆ omp_alloc()

void * kmp_tgt_allocator_t::omp_alloc ( size_t size,
omp_allocator_handle_t allocator )
inline

Invoke offload runtime's memory allocation routine.

Definition at line 1329 of file kmp_alloc.cpp.

References size.

◆ omp_free()

void kmp_tgt_allocator_t::omp_free ( void * ptr,
omp_allocator_handle_t allocator )
inline

Invoke offload runtime's memory deallocation routine.

Definition at line 1335 of file kmp_alloc.cpp.


The documentation for this class was generated from the following file: