[PATCH] D76726: Allow IndexType inside tensors.

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 12:54:31 PDT 2020


silvas created this revision.
silvas added a reviewer: rriddle.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, mehdi_amini, arphaman.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a project: LLVM.
silvas updated this revision to Diff 252410.
silvas added a comment.

Fix extraneous stuff in the diff


It's common in many dialects to use tensors to themselves hold tensor shapes (for example, the shape is itself the result of some non-trivial calculation). Currently, such dialects have to use `tensor<?xi64>` or worse (like allowing either i32 or i64 tensors to represent shapes). `tensor<?xindex>` is the natural type to represent this, but is currently disallowed. This patch allows it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76726

Files:
  mlir/include/mlir/IR/StandardTypes.h
  mlir/test/IR/invalid.mlir


Index: mlir/test/IR/invalid.mlir
===================================================================
--- mlir/test/IR/invalid.mlir
+++ mlir/test/IR/invalid.mlir
@@ -23,10 +23,6 @@
 
 func @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}}
 
-// -----
-
-func @indextensor(tensor<4 x index>) -> () // expected-error {{invalid tensor element type}}
-
 // -----
 // Test no map in memref type.
 func @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}}
Index: mlir/include/mlir/IR/StandardTypes.h
===================================================================
--- mlir/include/mlir/IR/StandardTypes.h
+++ mlir/include/mlir/IR/StandardTypes.h
@@ -330,7 +330,7 @@
     // element type within that dialect.
     return type.isa<ComplexType>() || type.isa<FloatType>() ||
            type.isa<IntegerType>() || type.isa<OpaqueType>() ||
-           type.isa<VectorType>() ||
+           type.isa<VectorType>() || type.isa<IndexType>() ||
            (type.getKind() > Type::Kind::LAST_STANDARD_TYPE);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76726.252410.patch
Type: text/x-patch
Size: 1061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/00bc8f14/attachment.bin>


More information about the llvm-commits mailing list