[all-commits] [llvm/llvm-project] 35ac9a: [flang][OpenMP] Lower target in_reduction for host...

Sairudra More via All-commits all-commits at lists.llvm.org
Thu Jun 11 03:02:41 PDT 2026


  Branch: refs/heads/users/saieiei/target-in-reduction
  Home:   https://github.com/llvm/llvm-project
  Commit: 35ac9a474e5aebe868665ed9b0742f3e3612c4f7
      https://github.com/llvm/llvm-project/commit/35ac9a474e5aebe868665ed9b0742f3e3612c4f7
  Author: Sairudra More <sairudra60 at gmail.com>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    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 mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
    M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
    M mlir/test/Dialect/OpenMP/invalid.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 for host fallback

Teach Flang lowering and MLIR OpenMP translation to carry
in_reduction through omp.target for the host-fallback path.

The translation looks up task reduction-private storage with
__kmpc_task_reduction_get_th_data and binds the target region's
in_reduction block argument to that private pointer, so uses inside the
region do not keep referring to the original variable.

The patch also preserves in_reduction operands in the TargetOp builder
path and ensures target in_reduction list items are mapped into the
target region when needed.

The device/offload-entry path remains diagnosed as not yet implemented.


  Commit: dd072433da2bba2ca2515a760ac150a14da2e917
      https://github.com/llvm/llvm-project/commit/dd072433da2bba2ca2515a760ac150a14da2e917
  Author: Sairudra More <moresair at pe31.hpc.amslabs.hpecorp.net>
  Date:   2026-06-11 (Thu, 11 Jun 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/target-inreduction-unused.f90
    M flang/test/Lower/OpenMP/target-inreduction.f90
    M flang/test/Transforms/OpenMP/function-filtering-host-ops.mlir
    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/invalid.mlir
    M mlir/test/Target/LLVMIR/openmp-target-in-reduction.mlir
    M mlir/test/Target/LLVMIR/openmp-todo.mlir

  Log Message:
  -----------
  [flang][OpenMP] Model target in_reduction through map entries

Model omp.target in_reduction so the target body uses the mapped
map_entries block argument instead of a separate in_reduction entry
block argument.

The in_reduction operands remain on the op for host-side translation.
For the host-fallback path, the matching map block argument is redirected
to the pointer returned by __kmpc_task_reduction_get_th_data, so the
target body accumulates into the task reduction-private storage.

Flang lowering now relies on the implicit address-preserving map for the
target body binding, while task and taskloop keep their existing
in_reduction block-argument behavior.

Offload/device compilation is still diagnosed as not yet implemented, and
each target in_reduction variable must have a matching map_entries entry.


Compare: https://github.com/llvm/llvm-project/compare/e92d576b0917...dd072433da2b

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