From 4b6447e220fd86d5e45461d4d00593fb91e10880 Mon Sep 17 00:00:00 2001 From: Alex Zinenko Date: Mon, 17 Oct 2022 13:37:09 +0000 Subject: [PATCH] [mlir] stopgap for incorrect vector.contract lowering `vector.contract` is being lowered to the default mul/add contraction regardless if of the kind indicated. Stop the lowering completely in this case until the correct one can be implemented. Reviewed By: springerm, ThomasRaoux Differential Revision: https://reviews.llvm.org/D136079 --- mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp index 570b4b2..0bdaf7b 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp @@ -1862,6 +1862,13 @@ ContractionOpLowering::matchAndRewrite(vector::ContractionOp op, op.getRhsType().getElementType() != getElementTypeOrSelf(op.getAccType())) return failure(); + // TODO: the code below assumes the default contraction, make sure it supports + // other kinds before enabling this lowering. + if (op.getKind() != vector::CombiningKind::ADD) { + return rewriter.notifyMatchFailure( + op, "contractions other than 'add' not supported"); + } + // TODO: implement benefits, cost models. MLIRContext *ctx = op.getContext(); ContractionOpToMatmulOpLowering pat1(vectorTransformOptions, ctx); -- 2.7.4