[Mlir-commits] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)

Michael Kruse llvmlistbot at llvm.org
Tue Oct 22 06:00:08 PDT 2024


================
@@ -6403,16 +6401,45 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::createTargetData(
       SrcLocInfo = getOrCreateIdent(SrcLocStr, SrcLocStrSize);
     }
 
-    Value *OffloadingArgs[] = {SrcLocInfo,           DeviceID,
-                               PointerNum,           RTArgs.BasePointersArray,
-                               RTArgs.PointersArray, RTArgs.SizesArray,
-                               RTArgs.MapTypesArray, RTArgs.MapNamesArray,
-                               RTArgs.MappersArray};
+    SmallVector<llvm::Value *, 13> OffloadingArgs = {
+        SrcLocInfo,           DeviceID,
+        PointerNum,           RTArgs.BasePointersArray,
+        RTArgs.PointersArray, RTArgs.SizesArray,
+        RTArgs.MapTypesArray, RTArgs.MapNamesArray,
+        RTArgs.MappersArray};
 
     if (IsStandAlone) {
       assert(MapperFunc && "MapperFunc missing for standalone target data");
-      Builder.CreateCall(getOrCreateRuntimeFunctionPtr(*MapperFunc),
-                         OffloadingArgs);
+
+      auto TaskBodyCB = [&](Value *, Value *, IRBuilderBase::InsertPoint) {
+        if (Info.HasNoWait) {
+          OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32));
+          OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr));
+          OffloadingArgs.push_back(llvm::Constant::getNullValue(Int32));
+          OffloadingArgs.push_back(llvm::Constant::getNullValue(VoidPtr));
----------------
Meinersbur wrote:

```suggestion
          OffloadingArgs.append({
            llvm::Constant::getNullValue(Int32),
            llvm::Constant::getNullValue(VoidPtr),
            llvm::Constant::getNullValue(Int32),
            llvm::Constant::getNullValue(VoidPtr)
          });
```
(should work but did not test)

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


More information about the Mlir-commits mailing list