[Mlir-commits] [mlir] d6e9efa - [mlir][linalg][transform] Add verifier to MaskedVectorizeOp

Matthias Springer llvmlistbot at llvm.org
Thu Jul 6 07:25:01 PDT 2023


Author: Matthias Springer
Date: 2023-07-06T16:24:52+02:00
New Revision: d6e9efab8121cca270824546162b923767a8b1f1

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

LOG: [mlir][linalg][transform] Add verifier to MaskedVectorizeOp

Verify that the correct number of `scalable_sizes` was provided.

Differential Revision: https://reviews.llvm.org/D154600

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
index fe48ba5d035995..086a37452debf0 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.td
@@ -2036,6 +2036,8 @@ def MaskedVectorizeOp : Op<Transform_Dialect, "structured.masked_vectorize",
       `:` type($target)
   }];
 
+  let hasVerifier = 1;
+
   let extraClassDeclaration = [{
     // TODO: applyToOne.
     ::mlir::DiagnosedSilenceableFailure apply(

diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 440272ae8a6c47..eed58bbbf1e18c 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -3065,6 +3065,14 @@ SmallVector<OpFoldResult> MaskedVectorizeOp::getMixedVectorSizes() {
   return getMixedValues(getStaticVectorSizes(), getVectorSizes(), b);
 }
 
+LogicalResult transform::MaskedVectorizeOp::verify() {
+  if (getStaticVectorSizes().size() != getScalableSizes().size())
+    return emitOpError("expected same number of vector sizes (")
+           << getStaticVectorSizes().size() << ") and scalable sizes ("
+           << getScalableSizes().size() << ")";
+  return success();
+}
+
 //===----------------------------------------------------------------------===//
 // HoistRedundantVectorTransfersOp
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list