[llvm-branch-commits] [flang] [llvm] [mlir] [MLIR][OpenMP][OMPIRBuilder] Add lowering support for omp.target_triples (PR #100156)

Pranav Bhandarkar via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 31 05:07:59 PDT 2024


================
@@ -7053,13 +7053,30 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::emitTargetTask(
                     << "\n");
   return Builder.saveIP();
 }
+
 static void emitTargetCall(
     OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder,
     OpenMPIRBuilder::InsertPointTy AllocaIP, Function *OutlinedFn,
     Constant *OutlinedFnID, int32_t NumTeams, int32_t NumThreads,
     SmallVectorImpl<Value *> &Args,
     OpenMPIRBuilder::GenMapInfoCallbackTy GenMapInfoCB,
     SmallVector<llvm::OpenMPIRBuilder::DependData> Dependencies = {}) {
+  // Generate a function call to the host fallback implementation of the target
+  // region. This is called by the host when no offload entry was generated for
+  // the target region and when the offloading call fails at runtime.
+  auto &&EmitTargetCallFallbackCB =
----------------
bhandarkar-pranav wrote:

Just a note here, that `if (!OutlinedFnID)`, then we cannot simply inline a call to `OutlinedFn`. We need to the following check 
```
if (!OutlinedFnID) {
   if(RequiresOuterTargetTask)
       Builder.restoreIP(emitTargetTask(...));
   else
       Builder.restoreIP(EmitTargetCallFallBackCB(Builder.saveIP()));
}
```
But dont change this PR because I'll fold that into my upcoming changes and more importantly, `emitTargetTask` ->`emitKernelLaunch`  assert on `OutlinedFnID` [here](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp#L1088)

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


More information about the llvm-branch-commits mailing list