[llvm] [OpenMP][OMPIRBuilder] Add support to omp target parallel (PR #67000)

Dominik Adamski via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 04:20:50 PDT 2023


================
@@ -1137,8 +1139,12 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
   // Change the location to the outer alloca insertion point to create and
   // initialize the allocas we pass into the parallel region.
   Builder.restoreIP(OuterAllocaIP);
-  AllocaInst *TIDAddr = Builder.CreateAlloca(Int32, nullptr, "tid.addr");
-  AllocaInst *ZeroAddr = Builder.CreateAlloca(Int32, nullptr, "zero.addr");
+  unsigned AllocaAddressSpace =
+      Config.isTargetDevice() ? 0 : M.getDataLayout().getAllocaAddrSpace();
----------------
DominikAdamski wrote:

Without this change the outlined function will have the following signature:
define internal void @__omp_offloading_fd00_2b03043__QQmain_l30..omp_par(**ptr addrspace(5)** noalias noundef %tid.addr, **ptr addrspace(5**) noalias noundef %zero.addr, **ptr addrspace(5**) %0)
(Tested on AMD GPU target)

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


More information about the llvm-commits mailing list