[Mlir-commits] [mlir] 4a8c70c - [mlir][Linalg] Reintroduced missing verification check

Nicolas Vasilache llvmlistbot at llvm.org
Tue Oct 6 01:13:06 PDT 2020


Author: Nicolas Vasilache
Date: 2020-10-06T07:59:59Z
New Revision: 4a8c70c3194aeeb286b4bea1666168f710cbe04f

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

LOG: [mlir][Linalg] Reintroduced missing verification check

A verification check on the number of indexing maps seems to have dropped inadvertently. Also update the relevant roundtrip tests.

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    mlir/test/Dialect/Linalg/roundtrip.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 26aa75955e3c..082078dee3af 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -398,6 +398,12 @@ static LogicalResult verifyGenericOp(GenericOpType op) {
     expectedNumSymbols = op.getShapedType(index).getRank();
   }
 
+  if (op.indexing_maps().size() != op.getNumInputsAndOutputs())
+    return op.emitOpError("expected the number of indexing_map (")
+           << op.indexing_maps().size()
+           << ") to be equal to the number of inputs and outputs ("
+           << op.getNumInputsAndOutputs() << ")";
+
   SmallVector<AffineMap, 4> indexingMaps;
   indexingMaps.reserve(op.indexing_maps().size());
   for (auto en : llvm::enumerate(op.indexing_maps())) {

diff  --git a/mlir/test/Dialect/Linalg/roundtrip.mlir b/mlir/test/Dialect/Linalg/roundtrip.mlir
index 868cabb5eff3..b4347ca89887 100644
--- a/mlir/test/Dialect/Linalg/roundtrip.mlir
+++ b/mlir/test/Dialect/Linalg/roundtrip.mlir
@@ -343,6 +343,7 @@ func @generic_with_tensor_input(%arg0: tensor<?x?xvector<3x4xi4>>,
 
 #accesses = [
   affine_map<(i, j, k) -> (j, i)>,
+  affine_map<(i, j, k) -> (i, k, i + j)>,
   affine_map<(i, j, k) -> (i, k, i + j)>
 ]
 
@@ -377,6 +378,7 @@ func @generic_with_tensor_input_and_output(
 
 #accesses = [
   affine_map<(i, j, k) -> (j, i)>,
+  affine_map<(i, j, k) -> (i, k, i + j)>,
   affine_map<(i, j, k) -> (i, k, i + j)>
 ]
 


        


More information about the Mlir-commits mailing list