[flang-commits] [flang] [mlir] [flang][OpenMP] Lower target in_reduction for host fallback (PR #199967)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Tue Jun 23 06:55:10 PDT 2026
================
@@ -436,18 +436,28 @@ static void bindEntryBlockArgs(lower::AbstractConverter &converter,
.first);
};
- // Process in clause name alphabetical order to match block arguments order.
// Do not bind host_eval variables because they cannot be used inside of the
// corresponding region, except for very specific cases handled separately.
+ //
+ // For `omp.task` / `omp.taskloop`, `in_reduction` list items have their own
+ // entry block argument and are bound here like other private-like variables.
+ //
+ // `in_reduction` list items on `omp.target` are not given their own entry
+ // block argument (`args.inReduction` is left empty for target), so the
+ // in_reduction bind below is a no-op there. Instead they are implicitly
+ // mapped, so in-body references resolve to the `map_entries` block argument
+ // bound here; the host side uses the `in_reduction` clause metadata to
+ // redirect that mapped value to the per-task reduction-private storage during
+ // translation.
----------------
skatrak wrote:
Nit: This information belongs in `genTargetOp` where the `ObjectEntryBlockArgs` structure is initialized, and it's already there. I'd remove it from here because there's no special handling for it.
https://github.com/llvm/llvm-project/pull/199967
More information about the flang-commits
mailing list