[Mlir-commits] [mlir] [mlir][gpu] Align reduction operations with vector combining kinds (PR #73423)
Jakub Kuderski
llvmlistbot at llvm.org
Sun Nov 26 15:14:24 PST 2023
================
@@ -485,12 +487,23 @@ static LogicalResult verifyAttributions(Operation *op,
// AllReduceOp
//===----------------------------------------------------------------------===//
-static bool verifyReduceOpAndType(gpu::AllReduceOperation opName,
- Type resType) {
- return (opName != gpu::AllReduceOperation::AND &&
- opName != gpu::AllReduceOperation::OR &&
- opName != gpu::AllReduceOperation::XOR) ||
- llvm::isa<IntegerType>(resType);
+static LogicalResult verifyReduceOpAndType(gpu::AllReduceOperation opName,
+ Type resType) {
+ using Kind = gpu::AllReduceOperation;
+ if (llvm::is_contained(
+ {Kind::MINF, Kind::MAXF, Kind::MINIMUMF, Kind::MAXIMUMF}, opName)) {
+ if (!isa<FloatType>(resType))
+ return failure();
+ }
+
+ if (llvm::is_contained({Kind::MINSI, Kind::MINUI, Kind::MAXSI, Kind::MAXUI,
+ Kind::AND, Kind::OR, Kind::XOR},
+ opName)) {
+ if (!isa<IntegerType>(resType))
+ return failure();
+ }
+
----------------
kuhar wrote:
I added extra type constraints in the op definition
https://github.com/llvm/llvm-project/pull/73423
More information about the Mlir-commits
mailing list