[all-commits] [llvm/llvm-project] 576993: [mlir][flang][openmp] Rework parallel reduction op...

David Truby via All-commits all-commits at lists.llvm.org
Wed Jan 24 07:36:47 PST 2024


  Branch: refs/heads/users/davidtruby/reduction
  Home:   https://github.com/llvm/llvm-project
  Commit: 576993ab238f18788a9affb9df2ccc4892d06cb0
      https://github.com/llvm/llvm-project/commit/576993ab238f18788a9affb9df2ccc4892d06cb0
  Author: David Truby <david at truby.dev>
  Date:   2024-01-24 (Wed, 24 Jan 2024)

  Changed paths:
    M flang/lib/Lower/OpenMP.cpp
    M flang/test/Lower/OpenMP/FIR/parallel-reduction-add.f90
    M flang/test/Lower/OpenMP/parallel-reduction-add.f90
    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/ops.mlir
    M mlir/test/Target/LLVMIR/openmp-reduction.mlir

  Log Message:
  -----------
  [mlir][flang][openmp] Rework parallel reduction operations

This patch reworks the way that parallel reduction operations function to better
match the expected semantics from the OpenMP specification. Previously specific
omp.reduction operations were used inside the region, meaning that the reduction
only applied when the correct operation was used, whereas the specification
states that any change to the variable inside the region should be taken into
account for the reduction.

The new semantics create a private reduction variable as a block argument which
should be used normally for all operations on that variable in the region; this
private variable is then combined with the others into the shared variable. This
way no special omp.reduction operations are needed inside the region.

This patch only makes the change for the `parallel` operation, the change for
the `wsloop` operation will be in a separate patch.




More information about the All-commits mailing list