[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering
authorValentin Clement <clementval@gmail.com>
Wed, 11 Mar 2020 12:56:31 +0000 (13:56 +0100)
committerStephan Herhut <herhut@google.com>
Wed, 11 Mar 2020 13:07:04 +0000 (14:07 +0100)
commitc7380995f8123558e0ac252d141d846fb97a869a
tree782d8aa8b062da90c8bd9f528b0afbe2938655c9
parentf6790a1c63598e9e55608d60d0f4c0a1b1be8ae9
[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering

Summary:
This patch add some builtin operation for the gpu.all_reduce ops.
- for Integer only: `and`, `or`, `xor`
- for Float and Integer: `min`, `max`

This is useful for higher level dialect like OpenACC or OpenMP that can lower to the GPU dialect.

Differential Revision: https://reviews.llvm.org/D75766
13 files changed:
mlir/include/mlir/Dialect/GPU/GPUOps.td
mlir/include/mlir/ExecutionEngine/RunnerUtils.h
mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
mlir/lib/ExecutionEngine/RunnerUtils.cpp
mlir/test/Dialect/GPU/all-reduce-max.mlir [new file with mode: 0644]
mlir/test/Dialect/GPU/invalid.mlir
mlir/test/mlir-cuda-runner/all-reduce-and.mlir [new file with mode: 0644]
mlir/test/mlir-cuda-runner/all-reduce-max.mlir [new file with mode: 0644]
mlir/test/mlir-cuda-runner/all-reduce-min.mlir [new file with mode: 0644]
mlir/test/mlir-cuda-runner/all-reduce-or.mlir [new file with mode: 0644]
mlir/test/mlir-cuda-runner/all-reduce-xor.mlir [new file with mode: 0644]