[llvm-branch-commits] [flang] [mlir] [flang][OpenMP] Lower target in_reduction for host fallback (PR #199967)
Sairudra More via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 9 08:58:17 PDT 2026
================
@@ -8222,6 +8226,61 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
bool isOffloadEntry =
isTargetDevice || !ompBuilder->Config.TargetTriples.empty();
+ // Validate and resolve in_reduction clauses on omp.target. We currently
+ // only support the non-offload host-fallback path: the per-task private
+ // pointer is obtained by calling __kmpc_task_reduction_get_th_data inside
+ // the to-be-outlined target task body. Threading that pointer through the
+ // device kernel argument list is left as follow-up work.
+ SmallVector<llvm::Value *> inRedOrigPtrs;
+ if (!targetOp.getInReductionVars().empty()) {
+ if (isTargetDevice || isOffloadEntry)
----------------
Saieiei wrote:
I pushed a separate prototype commit for this direction. The target body now uses the matching map_entries block argument instead of a separate in_reduction block argument, while the in_reduction operands remain as host-side metadata. I kept it as a separate commit so it can be reviewed/rolled back independently if this direction does not hold up.
https://github.com/llvm/llvm-project/pull/199967
More information about the llvm-branch-commits
mailing list