[all-commits] [llvm/llvm-project] b21593: [OpenMP][libomptarget][AMDGPU] lock/unlock (pin/un...

carlobertolli via All-commits all-commits at lists.llvm.org
Fri Jan 13 10:19:17 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b215932e69912bd4ad800b695469252417a9e543
  Author: Carlo Bertolli <carlo.bertolli at amd.com>
  Date:   2023-01-13 (Fri, 13 Jan 2023)

  Changed paths:
    M openmp/libomptarget/include/omptargetplugin.h
    M openmp/libomptarget/include/rtl.h
    M openmp/libomptarget/plugins/amdgpu/impl/impl.cpp
    M openmp/libomptarget/plugins/amdgpu/impl/impl_runtime.h
    M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    M openmp/libomptarget/src/api.cpp
    M openmp/libomptarget/src/exports
    M openmp/libomptarget/src/omptarget.cpp
    M openmp/libomptarget/src/private.h
    M openmp/libomptarget/src/rtl.cpp
    A openmp/libomptarget/test/mapping/prelock.cpp
    M openmp/runtime/src/kmp_alloc.cpp

  Log Message:
  [OpenMP][libomptarget][AMDGPU] lock/unlock (pin/unpin) mechanism in libomptarget amdgpu plugin (API and implementation)
The current only way to obtain pinned memory with libomptarget is to use a custom allocator llvm_omp_target_alloc_host.
This reflects well the CUDA implementation of libomptarget, but it does not correctly expose the AMDGPU runtime API,
where any system allocated page can be locked/unlocked through a call to hsa_amd_memory_lock/unlock.
This patch enables users to allocate memory through malloc (mmap, sbreak) and then pin the related memory pages
with a libomptarget special call. It is a base support in the amdgpu libomptarget plugin to enable users to prelock
their host memory pages so that the runtime doesn't need to lock them itself for asynchronous memory transfers.

Reviewed By: jdoerfert, ye-luo

Differential Revision: https://reviews.llvm.org/D139208

More information about the All-commits mailing list