This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add allocator support for target memory
ClosedPublic

Authored by hbae on Feb 14 2021, 1:41 PM.

Details

Summary

This is a preview of allocator support for target memory that depends on the
offload runtime API which allocates memory as described below.

llvm_omp_target_alloc_host(size_t size, int device_num);

  • Returns non-migratable memory owned by host.
  • Memory is accessible by host and device(s).

llvm_omp_target_alloc_shared(size_t size, int device_num);

  • Returns migratable memory owned by host and device.
  • Memory is accessible by host and device.

llvm_omp_target_alloc_device(size_t size, int device_num);

  • Returns memory owned by device.
  • Memory is only accessible by device.

New memory space and predefined allocator names are

  • llvm_omp_target_host_mem_space
  • llvm_omp_target_shared_mem_space
  • llvm_omp_target_device_mem_space
  • llvm_omp_target_host_mem_alloc
  • llvm_omp_target_shared_mem_alloc
  • llvm_omp_target_device_mem_alloc

Diff Detail

Event Timeline

hbae created this revision.Feb 14 2021, 1:41 PM
hbae requested review of this revision.Feb 14 2021, 1:41 PM
hbae updated this revision to Diff 326215.Feb 24 2021, 3:16 PM

Changed prefix from preomp to llvm_omp.

hbae edited the summary of this revision. (Show Details)Feb 24 2021, 3:18 PM

Do you also have the API calls and libomptarget integration?

hbae added a comment.Feb 24 2021, 5:13 PM

There will be a separate patch for libomptarget.

jdoerfert accepted this revision.Mar 2 2021, 9:00 AM

LG, make sure to clang format the code.

This revision is now accepted and ready to land.Mar 2 2021, 9:00 AM
This revision was landed with ongoing or failed builds.Mar 2 2021, 2:46 PM
This revision was automatically updated to reflect the committed changes.