[all-commits] [llvm/llvm-project] 197f3e: [flang][OpenMP] lower simple array reductions (#84...

Tom Eccles via All-commits all-commits at lists.llvm.org
Wed Mar 20 03:35:33 PDT 2024


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

  Changed paths:
    M flang/include/flang/Optimizer/Builder/HLFIRTools.h
    M flang/lib/Lower/OpenMP/ReductionProcessor.cpp
    M flang/lib/Lower/OpenMP/ReductionProcessor.h
    M flang/lib/Optimizer/Builder/HLFIRTools.cpp
    R flang/test/Lower/OpenMP/Todo/reduction-arrays.f90
    A flang/test/Lower/OpenMP/parallel-reduction-array.f90
    A flang/test/Lower/OpenMP/parallel-reduction-array2.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-array.f90
    A flang/test/Lower/OpenMP/wsloop-reduction-array2.f90

  Log Message:
  -----------
  [flang][OpenMP] lower simple array reductions (#84958)

This has been tested with arrays with compile-time constant bounds.
Allocatable arrays and arrays with non-constant bounds are not yet
supported. User-defined reduction functions are also not yet supported.

The design is intended to work for arrays with non-constant bounds too
without a lot of extra work (mostly there are bugs in OpenMPIRBuilder I
haven't fixed yet).

We need some way to get these runtime bounds into the reduction init and
combiner regions. To keep things simple for now I opted to always box
the array arguments so the box can be passed as one argument and the
lower bounds and extents read from the box. This has the disadvantage of
resulting in fir.box_dim operations inside of the critical section. If
these prove to be a performance issue, we could follow OpenACC reading
box lower bounds and extents before the reduction and passing them as
block arguments to the reduction init and combiner regions. I would
prefer to keep things simple for now.

Note: this implementation only works when the HLFIR lowering is used. I
don't think it is worth supporting FIR-only lowering because the plan is
for that to be removed soon.

OpenMP array reductions 6/6
Previous PR: https://github.com/llvm/llvm-project/pull/84957



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