[Mlir-commits] [llvm] [mlir] [OMPIRBuilder] - Make offloading input data persist for deferred target tasks (PR #133499)
Sergio Afonso
llvmlistbot at llvm.org
Thu May 8 05:50:52 PDT 2025
================
@@ -7051,9 +7051,25 @@ static Expected<Function *> createOutlinedFunction(
/// void @.omp_target_task_proxy_func(i32 %thread.id, ptr %task)
/// This function is called from emitTargetTask once the
/// code to launch the target kernel has been outlined already.
-static Function *emitTargetTaskProxyFunction(OpenMPIRBuilder &OMPBuilder,
- IRBuilderBase &Builder,
- CallInst *StaleCI) {
+static Function *emitTargetTaskProxyFunction(
+ OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, CallInst *StaleCI,
+ StructType *PrivatesTy, StructType *TaskWithPrivatesTy,
+ const size_t NumOffloadingArrays, const int SharedArgsOperandNo) {
+
+ // NumOffloadingArrays is the number of offloading arrays that we need to copy
+ // into the task structure so that the deferred target task can access this
+ // data even after the stack frame of the generating task has been rolled
+ // back. Offloading arrays contain base pointers, pointers, sizes etc
+ // of the data that the target kernel will access. In other words, the
+ // arrays of pointers held by OpenMPIRBuilder::TargetDataRTArgs
+ // The number of arrays and the size of each array depends on the specifics of
+ // the target call. These arrays are copied into a struct whose type is
+ // PrivatesTy. So, if NumOffloadingArrays is non-zero, PrivatesTy better
+ // not be nullptr
----------------
skatrak wrote:
Nit: It seems like a big chunk of this comment can be moved above to the function documentation for these arguments.
https://github.com/llvm/llvm-project/pull/133499
More information about the Mlir-commits
mailing list