[Mlir-commits] [clang] [llvm] [mlir] [flang][OpenMP] Support `target enter|update|exit .. nowait` (PR #113305)
Pranav Bhandarkar
llvmlistbot at llvm.org
Tue Oct 22 13:29:43 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));
+ }
+
+ Builder.CreateCall(getOrCreateRuntimeFunctionPtr(*MapperFunc),
+ OffloadingArgs);
+
+ if (Info.HasNoWait) {
+ BasicBlock *OffloadContBlock =
+ BasicBlock::Create(Builder.getContext(), "omp_offload.cont");
+ auto *CurFn = Builder.GetInsertBlock()->getParent();
+ emitBranch(OffloadContBlock);
+ emitBlock(OffloadContBlock, CurFn, /*IsFinished=*/true);
----------------
bhandarkar-pranav wrote:
`emitBlock` calls `emitBranch`, so are both of these calls needed?
https://github.com/llvm/llvm-project/pull/113305
More information about the Mlir-commits
mailing list