[all-commits] [llvm/llvm-project] 23bc34: [Libomptarget] Change device free routines to acce...
Joseph Huber via All-commits
all-commits at lists.llvm.org
Wed Sep 14 10:14:34 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 23bc343855fdf6fb7668abadf2b064034b207981
https://github.com/llvm/llvm-project/commit/23bc343855fdf6fb7668abadf2b064034b207981
Author: Joseph Huber <jhuber6 at vols.utk.edu>
Date: 2022-09-14 (Wed, 14 Sep 2022)
Changed paths:
M openmp/libomptarget/include/device.h
M openmp/libomptarget/include/omptarget.h
M openmp/libomptarget/include/omptargetplugin.h
M openmp/libomptarget/include/rtl.h
M openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
M openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
M openmp/libomptarget/plugins/cuda/src/rtl.cpp
M openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp
M openmp/libomptarget/plugins/remote/src/rtl.cpp
M openmp/libomptarget/plugins/ve/src/rtl.cpp
M openmp/libomptarget/src/api.cpp
M openmp/libomptarget/src/device.cpp
M openmp/libomptarget/src/exports
M openmp/libomptarget/src/omptarget.cpp
M openmp/libomptarget/src/private.h
M openmp/libomptarget/test/api/omp_device_managed_memory.c
M openmp/libomptarget/test/api/omp_host_pinned_memory.c
M openmp/runtime/src/kmp_alloc.cpp
Log Message:
-----------
[Libomptarget] Change device free routines to accept the allocation kind
Previous support for device memory allocators used a single free
routine and did not provide the original kind of the allocation. This is
problematic as some of these memory types required different handling.
Previously this was worked around using a map in runtime to record the
original kind of each pointer. Instead, this patch introduces new free
routines similar to the existing allocation routines. This allows us to
avoid a map traversal every time we free a device pointer.
The only interfaces defined by the standard are `omp_target_alloc` and
`omp_target_free`, these do not take a kind as `omp_alloc` does. The
standard dictates the following:
"The omp_target_alloc routine returns a device pointer that references
the device address of a storage location of size bytes. The storage
location is dynamically allocated in the device data environment of the
device specified by device_num."
Which suggests that these routines only allocate the default device
memory for the kind. So this has been changed to reflect this. This
change is somewhat breaking if users were using `omp_target_free` as
previously shown in the tests.
Reviewed By: JonChesterfield, tianshilei1992
Differential Revision: https://reviews.llvm.org/D133053
More information about the All-commits
mailing list