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

Tom Eccles via All-commits all-commits at lists.llvm.org
Thu Mar 7 02:58:41 PST 2024


  Branch: refs/heads/users/tblah/omp_byref_3
  Home:   https://github.com/llvm/llvm-project
  Commit: 07d9f417ecc8f0ea44969b6648218d4c72274aa6
      https://github.com/llvm/llvm-project/commit/07d9f417ecc8f0ea44969b6648218d4c72274aa6
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2024-03-07 (Thu, 07 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-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

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