[PATCH] D79684: [mlir][shape] Tidy up shape.shape_of
Sean Silva via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 9 19:40:22 PDT 2020
silvas created this revision.
silvas added a reviewer: jpienaar.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added 1 blocking reviewer(s): jpienaar.
Herald added a project: LLVM.
silvas added a subscriber: stellaraccident.
- Mark it NoSideEffect
- Add custom parser/printer
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79684
Files:
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
mlir/test/Dialect/Shape/ops.mlir
Index: mlir/test/Dialect/Shape/ops.mlir
===================================================================
--- mlir/test/Dialect/Shape/ops.mlir
+++ mlir/test/Dialect/Shape/ops.mlir
@@ -62,3 +62,8 @@
%1 = shape.const_shape [1, 2, 3]
return
}
+
+func @test_shape_of(%arg0: tensor<?xf32>) -> !shape.shape {
+ %0 = shape.shape_of %arg0 : tensor<?xf32>
+ return %0 : !shape.shape
+}
Index: mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
===================================================================
--- mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -226,12 +226,14 @@
}
def Shape_ShapeOfOp : Shape_Op<"shape_of",
- [DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
+ [NoSideEffect, DeclareOpInterfaceMethods<InferTypeOpInterface>]> {
let summary = "Returns shape of a value or shaped type operand";
let arguments = (ins AnyTypeOf<[AnyShaped, Shape_ValueShapeType]>:$arg);
let results = (outs Shape_ShapeType:$result);
+ let assemblyFormat = "attr-dict $arg `:` type($arg)";
+
let hasFolder = 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79684.263048.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200510/40b1abb7/attachment.bin>
More information about the llvm-commits
mailing list