[Openmp-commits] [openmp] [OpenMP] Basic BumpAllocator for (AMD)GPUs (PR #69806)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 20 19:57:17 PDT 2023


================
@@ -36,6 +46,15 @@ extern "C" {
 #pragma omp end declare variant
 
 #ifdef __AMDGCN__
+#pragma omp begin declare variant match(                                       \
+        device = {arch(amdgcn)},                                               \
+            implementation = {extension(disable_implicit_base)})
+
+void *malloc(size_t Size) { return llvm_device_malloc(Size); }
+void free(void *Ptr) { llvm_device_free(Ptr); }
----------------
jdoerfert wrote:

You're right. We always replace calls to malloc. I can try your proposal, it's a little unfortunate that we then provide different entry points but that might be the price to pay.

https://github.com/llvm/llvm-project/pull/69806


More information about the Openmp-commits mailing list