[PATCH] D76349: [mlir] vector.type_cast: disallow memrefs with layout in verifier
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 19 02:39:47 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbc18624b4038: [mlir] vector.type_cast: disallow memrefs with layout in verifier (authored by ftynse).
Changed prior to commit:
https://reviews.llvm.org/D76349?vs=251026&id=251309#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76349/new/
https://reviews.llvm.org/D76349
Files:
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/test/Dialect/Vector/invalid.mlir
Index: mlir/test/Dialect/Vector/invalid.mlir
===================================================================
--- mlir/test/Dialect/Vector/invalid.mlir
+++ mlir/test/Dialect/Vector/invalid.mlir
@@ -1046,3 +1046,10 @@
// expected-error at +1 {{'vector.reduction' op unsupported reduction rank: 2}}
%0 = vector.reduction "add", %arg0 : vector<4x16xf32> into f32
}
+
+// -----
+
+func @type_cast_layout(%arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>>) {
+ // expected-error at +1 {{expects operand to be a memref with no layout}}
+ %0 = vector.type_cast %arg0: memref<4x3xf32, affine_map<(d0, d1)[s0, s1, s2] -> (d0 * s0 + d1 * s1 + s2)>> to memref<vector<4x3xf32>>
+}
Index: mlir/lib/Dialect/Vector/VectorOps.cpp
===================================================================
--- mlir/lib/Dialect/Vector/VectorOps.cpp
+++ mlir/lib/Dialect/Vector/VectorOps.cpp
@@ -1483,6 +1483,10 @@
}
static LogicalResult verify(TypeCastOp op) {
+ MemRefType canonicalType = canonicalizeStridedLayout(op.getMemRefType());
+ if (!canonicalType.getAffineMaps().empty())
+ return op.emitOpError("expects operand to be a memref with no layout");
+
auto resultType = inferVectorTypeCastResultType(op.getMemRefType());
if (op.getResultMemRefType() != resultType)
return op.emitOpError("expects result type to be: ") << resultType;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76349.251309.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200319/d063a7a9/attachment.bin>
More information about the llvm-commits
mailing list