[all-commits] [llvm/llvm-project] bd668c: [flang][OpenMP] lower simple array reductions

Tom Eccles via All-commits all-commits at lists.llvm.org
Tue Mar 12 10:35:00 PDT 2024


  Branch: refs/heads/users/tblah/omp_array_reduction_6
  Home:   https://github.com/llvm/llvm-project
  Commit: bd668cd95d95d1e5b9c8436875c14878c98902ff
      https://github.com/llvm/llvm-project/commit/bd668cd95d95d1e5b9c8436875c14878c98902ff
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2024-03-12 (Tue, 12 Mar 2024)

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

  Log Message:
  -----------
  [flang][OpenMP] lower simple array reductions

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.



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