[PATCH] D74307: [MLIR] Support memrefs with complex element types.

Alexander Belyaev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 03:05:45 PST 2020


pifon2a created this revision.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: rriddle.
Herald added a project: LLVM.
pifon2a edited reviewers, added: ftynse, bkramer; removed: rriddle.
Herald added a reviewer: rriddle.

For some reason it is only possible to create memrefs of scalars or vectors but not complex numbers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74307

Files:
  mlir/lib/IR/StandardTypes.cpp
  mlir/test/IR/parser.mlir


Index: mlir/test/IR/parser.mlir
===================================================================
--- mlir/test/IR/parser.mlir
+++ mlir/test/IR/parser.mlir
@@ -133,6 +133,13 @@
 // CHECK: func @complex_types(complex<i1>) -> complex<f32>
 func @complex_types(complex<i1>) -> complex<f32>
 
+
+// CHECK: func @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
+func @memref_with_complex_elems(memref<1x?xcomplex<f32>>)
+
+// CHECK: func @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
+func @memref_with_vector_elems(memref<1x?xvector<10xf32>>)
+
 // CHECK: func @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
 func @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
 
Index: mlir/lib/IR/StandardTypes.cpp
===================================================================
--- mlir/lib/IR/StandardTypes.cpp
+++ mlir/lib/IR/StandardTypes.cpp
@@ -333,7 +333,8 @@
   auto *context = elementType.getContext();
 
   // Check that memref is formed from allowed types.
-  if (!elementType.isIntOrFloat() && !elementType.isa<VectorType>())
+  if (!elementType.isIntOrFloat() && !elementType.isa<VectorType>() &&
+      !elementType.isa<ComplexType>())
     return emitOptionalError(location, "invalid memref element type"),
            MemRefType();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74307.243497.patch
Type: text/x-patch
Size: 1312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200210/49b398e0/attachment.bin>


More information about the llvm-commits mailing list