File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,11 @@ def _typeArrayAttr(x, context):
263
263
return _arrayAttr ([TypeAttr .get (t , context = context ) for t in x ], context )
264
264
265
265
266
+ @register_attribute_builder ("MemRefTypeAttr" )
267
+ def _memref_type_attr (x , context ):
268
+ return _typeAttr (x , context )
269
+
270
+
266
271
try :
267
272
import numpy as np
268
273
Original file line number Diff line number Diff line change 3
3
from mlir .ir import *
4
4
import mlir .dialects .func as func
5
5
import mlir .dialects .memref as memref
6
+ import mlir .extras .types as T
6
7
7
8
8
9
def run (f ):
@@ -76,3 +77,14 @@ def testCustomBuidlers():
76
77
# CHECK: memref.load %[[ARG0]][%[[ARG1]], %[[ARG2]]]
77
78
print (module )
78
79
assert module .operation .verify ()
80
+
81
+
82
+ # CHECK-LABEL: TEST: testMemRefAttr
83
+ @run
84
+ def testMemRefAttr ():
85
+ with Context () as ctx , Location .unknown (ctx ):
86
+ module = Module .create ()
87
+ with InsertionPoint (module .body ):
88
+ memref .global_ ("objFifo_in0" , T .memref (16 , T .i32 ()))
89
+ # CHECK: memref.global @objFifo_in0 : memref<16xi32>
90
+ print (module )
You can’t perform that action at this time.
0 commit comments