[mlir] add support for reductions in OpenMP WsLoopOp
authorAlex Zinenko <zinenko@google.com>
Thu, 8 Jul 2021 08:59:02 +0000 (10:59 +0200)
committerAlex Zinenko <zinenko@google.com>
Fri, 9 Jul 2021 15:54:20 +0000 (17:54 +0200)
commitc282d55a38577e076b48cd7a8113e5eb0a2039cd
tree25456d469877b0d87d5d2f4e941274027cd136ab
parentd4df3825bd32277074b3859f5dea9593139147fb
[mlir] add support for reductions in OpenMP WsLoopOp

Use a modeling similar to SCF ParallelOp to support arbitrary parallel
reductions. The two main differences are: (1) reductions are named and declared
beforehand similarly to functions using a special op that provides the neutral
element, the reduction code and optionally the atomic reduction code; (2)
reductions go through memory instead because this is closer to the OpenMP
semantics.

See https://llvm.discourse.group/t/rfc-openmp-reduction-support/3367.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D105358
mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt
mlir/include/mlir/Dialect/OpenMP/OpenMPDialect.h
mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
mlir/lib/Dialect/OpenMP/CMakeLists.txt
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
mlir/test/Dialect/OpenMP/invalid.mlir
mlir/test/Dialect/OpenMP/ops.mlir
mlir/test/Target/LLVMIR/openmp-llvm.mlir