6
6
import mlir .dialects .tensor as tensor
7
7
import mlir .dialects .arith as arith
8
8
9
+ test .register_python_test_dialect (get_dialect_registry ())
10
+
9
11
10
12
def run (f ):
11
13
print ("\n TEST:" , f .__name__ )
@@ -17,7 +19,6 @@ def run(f):
17
19
@run
18
20
def testAttributes ():
19
21
with Context () as ctx , Location .unknown ():
20
- test .register_python_test_dialect (ctx )
21
22
#
22
23
# Check op construction with attributes.
23
24
#
@@ -138,7 +139,6 @@ def testAttributes():
138
139
@run
139
140
def attrBuilder ():
140
141
with Context () as ctx , Location .unknown ():
141
- test .register_python_test_dialect (ctx )
142
142
# CHECK: python_test.attributes_op
143
143
op = test .AttributesOp (
144
144
# CHECK-DAG: x_affinemap = affine_map<() -> (2)>
@@ -215,7 +215,6 @@ def attrBuilder():
215
215
@run
216
216
def inferReturnTypes ():
217
217
with Context () as ctx , Location .unknown (ctx ):
218
- test .register_python_test_dialect (ctx )
219
218
module = Module .create ()
220
219
with InsertionPoint (module .body ):
221
220
op = test .InferResultsOp ()
@@ -260,7 +259,6 @@ def inferReturnTypes():
260
259
@run
261
260
def resultTypesDefinedByTraits ():
262
261
with Context () as ctx , Location .unknown (ctx ):
263
- test .register_python_test_dialect (ctx )
264
262
module = Module .create ()
265
263
with InsertionPoint (module .body ):
266
264
inferred = test .InferResultsOp ()
@@ -295,8 +293,6 @@ def resultTypesDefinedByTraits():
295
293
@run
296
294
def testOptionalOperandOp ():
297
295
with Context () as ctx , Location .unknown ():
298
- test .register_python_test_dialect (ctx )
299
-
300
296
module = Module .create ()
301
297
with InsertionPoint (module .body ):
302
298
op1 = test .OptionalOperandOp ()
@@ -312,7 +308,6 @@ def testOptionalOperandOp():
312
308
@run
313
309
def testCustomAttribute ():
314
310
with Context () as ctx :
315
- test .register_python_test_dialect (ctx )
316
311
a = test .TestAttr .get ()
317
312
# CHECK: #python_test.test_attr
318
313
print (a )
@@ -350,7 +345,6 @@ def testCustomAttribute():
350
345
@run
351
346
def testCustomType ():
352
347
with Context () as ctx :
353
- test .register_python_test_dialect (ctx )
354
348
a = test .TestType .get ()
355
349
# CHECK: !python_test.test_type
356
350
print (a )
@@ -397,8 +391,6 @@ def testCustomType():
397
391
# CHECK-LABEL: TEST: testTensorValue
398
392
def testTensorValue ():
399
393
with Context () as ctx , Location .unknown ():
400
- test .register_python_test_dialect (ctx )
401
-
402
394
i8 = IntegerType .get_signless (8 )
403
395
404
396
class Tensor (test .TestTensorValue ):
@@ -436,7 +428,6 @@ def __str__(self):
436
428
@run
437
429
def inferReturnTypeComponents ():
438
430
with Context () as ctx , Location .unknown (ctx ):
439
- test .register_python_test_dialect (ctx )
440
431
module = Module .create ()
441
432
i32 = IntegerType .get_signless (32 )
442
433
with InsertionPoint (module .body ):
@@ -488,8 +479,6 @@ def inferReturnTypeComponents():
488
479
@run
489
480
def testCustomTypeTypeCaster ():
490
481
with Context () as ctx , Location .unknown ():
491
- test .register_python_test_dialect (ctx )
492
-
493
482
a = test .TestType .get ()
494
483
assert a .typeid is not None
495
484
@@ -542,7 +531,6 @@ def type_caster(pytype):
542
531
@run
543
532
def testInferTypeOpInterface ():
544
533
with Context () as ctx , Location .unknown (ctx ):
545
- test .register_python_test_dialect (ctx )
546
534
module = Module .create ()
547
535
with InsertionPoint (module .body ):
548
536
i64 = IntegerType .get_signless (64 )
0 commit comments