[PATCH] D80705: [MLIR] Add TensorFromElementsOp to Standard ops.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 11:33:23 PDT 2020


rriddle added inline comments.


================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:1556
+    }]>];
+
+  let hasCanonicalizer = 1;
----------------
herhut wrote:
> pifon2a wrote:
> > herhut wrote:
> > > Would `let assemblyFormat = "`(` $elements `)` attr-dict `:` type($result)";` work?
> > no, it wouldn't. It would need to know the elements type to parse it. Can I use assemblyFormat for printing only and a custom parser?
> Answer is, it does not because the operand types cannot be deduced with the given traits.
You can do that with TypesMatchWith, this is common:
https://github.com/llvm/llvm-project/blob/0073c293a401774ac96b4b3d27f05e13f379f98e/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td#L484
https://github.com/llvm/llvm-project/blob/0073c293a401774ac96b4b3d27f05e13f379f98e/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td#L1479


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80705/new/

https://reviews.llvm.org/D80705





More information about the llvm-commits mailing list