[all-commits] [llvm/llvm-project] f46f5a: [flang][OpenMP][OMPIRBuilder][mlir] Optionally pas...

Tom Eccles via All-commits all-commits at lists.llvm.org
Wed Mar 13 07:51:32 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f46f5a01f4d5a7dcaf4a8fde5fc44eafdd9dbf27
      https://github.com/llvm/llvm-project/commit/f46f5a01f4d5a7dcaf4a8fde5fc44eafdd9dbf27
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2024-03-13 (Wed, 13 Mar 2024)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/lib/Lower/OpenMP/ReductionProcessor.cpp
    M flang/lib/Lower/OpenMP/ReductionProcessor.h
    A flang/test/Lower/OpenMP/FIR/parallel-reduction-add-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-add-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-iand-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-ieor-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-ior-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-eqv-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-logical-neqv-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-max-byref.f90
    A flang/test/Lower/OpenMP/FIR/wsloop-reduction-min-byref.f90
    A flang/test/Lower/OpenMP/default-clause-byref.f90
    A flang/test/Lower/OpenMP/delayed-privatization-reduction-byref.f90
    A flang/test/Lower/OpenMP/parallel-reduction-add-byref.f90
    A flang/test/Lower/OpenMP/parallel-reduction-byref.f90
    A flang/test/Lower/OpenMP/parallel-wsloop-reduction-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-add-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-add-hlfir-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-iand-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-ieor-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-ior-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-logical-and-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-logical-eqv-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-logical-neqv-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-logical-or-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-max-2-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-max-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-max-hlfir-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-min-byref.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-min2.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-mul-byref.f90
    M llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
    M llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
    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
    A mlir/test/Target/LLVMIR/openmp-reduction-byref.mlir

  Log Message:
  -----------
  [flang][OpenMP][OMPIRBuilder][mlir] Optionally pass reduction vars by ref (#84304)

Previously reduction variables were always passed by value into and out
of the initialization and combiner regions of the OpenMP reduction
declare operation.

This worked well for reductions of primitive types (and might perform
better than passing by reference). But passing by reference will be
useful for array and derived type reductions (e.g. to move allocation
inside of the init region).

Passing reductions by reference requires different LLVM-IR generation
when lowering from MLIR because some of the loads/stores/allocations
will now be moved inside of the init and combiner regions. This
alternate code generation is requested using a new attribute to
omp.wsloop and omp.parallel.

Existing lowerings from mlir are unaffected (these will continue to use
the by-value argument passing.

Flang will continue to pass by-value argument passing for trivial types
unless a (hidden) command line argument is supplied. Non-trivial types
will always use the by-ref lowering.

Array reductions are not ready yet (but are coming very soon). In the
meantime, this is tested by forcing existing reductions to use by-ref.

Commit series for by-ref OpenMP reductions 3/3

---------

Co-authored-by: Mats Petersson <mats.petersson at arm.com>



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