================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to