[Mlir-commits] [mlir] 4b6447e - [mlir] stopgap for incorrect vector.contract lowering

Alex Zinenko llvmlistbot at llvm.org
Mon Oct 17 07:49:44 PDT 2022


Author: Alex Zinenko
Date: 2022-10-17T14:49:34Z
New Revision: 4b6447e220fd86d5e45461d4d00593fb91e10880

URL: https://github.com/llvm/llvm-project/commit/4b6447e220fd86d5e45461d4d00593fb91e10880
DIFF: https://github.com/llvm/llvm-project/commit/4b6447e220fd86d5e45461d4d00593fb91e10880.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index 570b4b2ee001b..0bdaf7b56f829 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);


        


More information about the Mlir-commits mailing list