[all-commits] [llvm/llvm-project] 848d40: [flang][OpenMP] Lower target in_reduction (#199967)

Sairudra More via All-commits all-commits at lists.llvm.org
Tue Jul 14 20:35:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 848d409e60845352cfce85c2a23d1d262a0c68f3
      https://github.com/llvm/llvm-project/commit/848d409e60845352cfce85c2a23d1d262a0c68f3
  Author: Sairudra More <sairudra60 at gmail.com>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    A flang/test/Integration/OpenMP/target-inreduction-llvmir.f90
    A flang/test/Lower/OpenMP/Todo/target-inreduction-common.f90
    A flang/test/Lower/OpenMP/Todo/target-inreduction-equivalence.f90
    A flang/test/Lower/OpenMP/Todo/target-inreduction-firstprivate.f90
    R flang/test/Lower/OpenMP/Todo/target-inreduction.f90
    A flang/test/Lower/OpenMP/target-inreduction-unused.f90
    A flang/test/Lower/OpenMP/target-inreduction.f90
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    M mlir/include/mlir/Dialect/OpenMP/OpenMPClauses.td
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/host-op-filtering.mlir
    M mlir/test/Dialect/OpenMP/invalid.mlir
    A mlir/test/Target/LLVMIR/openmp-target-in-reduction-device.mlir
    A mlir/test/Target/LLVMIR/openmp-target-in-reduction-multi.mlir
    A mlir/test/Target/LLVMIR/openmp-target-in-reduction.mlir
    M mlir/test/Target/LLVMIR/openmp-todo.mlir

  Log Message:
  -----------
  [flang][OpenMP] Lower target in_reduction (#199967)

This patch carries `in_reduction` through `omp.target` for host
execution.

The lowering looks up the task-reduction private storage with
`__kmpc_task_reduction_get_th_data` and binds the target region argument
to that private pointer. This makes uses inside the target region refer
to the task-private reduction storage instead of continuing to use the
original variable.

This also fixes the `omp::TargetOp::build(TargetOperands)` path so
`in_reduction` operands are preserved instead of being dropped.

On the Flang side, `target in_reduction` list items are added to the
target map entries when needed, giving the translation a matching mapped
value to rewrite.

### Stack / review order

This PR is related to the OpenMP task-reduction translation stack:

1. #199565 — `omp.taskgroup task_reduction` translation
2. #199670 — `omp.taskloop` `reduction` / `in_reduction` translation
3. #202611 — explicit `omp.task in_reduction` translation

This PR is a target-specific sibling follow-up:

* #199967 — `omp.target in_reduction` host lowering

The intended main review order for the task/taskloop stack is:

#199565 → #199670 → #202611

This PR should be reviewed as the `omp.target in_reduction` host-side
lowering work built on the same task-reduction runtime model, not as a
dependency of #202611.

Addresses #199904.

Assisted-by: Claude Opus 4.8 and ChatGPT 5.5



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list