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

Alexander Belyaev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 03:13:02 PDT 2020


pifon2a created this revision.
pifon2a added reviewers: herhut, ftynse.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
herhut added a comment.

Thanks for cleaning this up!



================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:1532
+def TensorFromElementsOp : Std_Op<"tensor_from_elements",
+    [NoSideEffect, SameOperandsElementType]> {
+  string summary = "tensor from elements operation.";
----------------
Maybe use `SameOperandsAndResultElementType`?


================
Comment at: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td:1556
+    }]>];
+
+  let hasCanonicalizer = 1;
----------------
Would `let assemblyFormat = "`(` $elements `)` attr-dict `:` type($result)";` work?


================
Comment at: mlir/lib/Dialect/StandardOps/IR/Ops.cpp:1713
+    APInt index;
+    if (!matchPattern(*extract.indices().begin(), m_ConstantInt(&index))) {
+      return failure();
----------------
Remove extra '{' '}'.


Adds an operation that can create a 1D tensor from a list of values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80705

Files:
  mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
  mlir/lib/Dialect/StandardOps/IR/Ops.cpp
  mlir/test/IR/core-ops.mlir
  mlir/test/IR/invalid-ops.mlir
  mlir/test/Transforms/canonicalize.mlir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80705.266792.patch
Type: text/x-patch
Size: 8249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/f711ce76/attachment.bin>


More information about the llvm-commits mailing list