66import mlir .dialects .tensor as tensor
77import mlir .dialects .arith as arith
88
9+ test .register_python_test_dialect (get_dialect_registry ())
10+
911
1012def run (f ):
1113 print ("\n TEST:" , f .__name__ )
@@ -17,7 +19,6 @@ def run(f):
1719@run
1820def testAttributes ():
1921 with Context () as ctx , Location .unknown ():
20- test .register_python_test_dialect (ctx )
2122 #
2223 # Check op construction with attributes.
2324 #
@@ -138,7 +139,6 @@ def testAttributes():
138139@run
139140def attrBuilder ():
140141 with Context () as ctx , Location .unknown ():
141- test .register_python_test_dialect (ctx )
142142 # CHECK: python_test.attributes_op
143143 op = test .AttributesOp (
144144 # CHECK-DAG: x_affinemap = affine_map<() -> (2)>
@@ -215,7 +215,6 @@ def attrBuilder():
215215@run
216216def inferReturnTypes ():
217217 with Context () as ctx , Location .unknown (ctx ):
218- test .register_python_test_dialect (ctx )
219218 module = Module .create ()
220219 with InsertionPoint (module .body ):
221220 op = test .InferResultsOp ()
@@ -260,7 +259,6 @@ def inferReturnTypes():
260259@run
261260def resultTypesDefinedByTraits ():
262261 with Context () as ctx , Location .unknown (ctx ):
263- test .register_python_test_dialect (ctx )
264262 module = Module .create ()
265263 with InsertionPoint (module .body ):
266264 inferred = test .InferResultsOp ()
@@ -295,8 +293,6 @@ def resultTypesDefinedByTraits():
295293@run
296294def testOptionalOperandOp ():
297295 with Context () as ctx , Location .unknown ():
298- test .register_python_test_dialect (ctx )
299-
300296 module = Module .create ()
301297 with InsertionPoint (module .body ):
302298 op1 = test .OptionalOperandOp ()
@@ -312,7 +308,6 @@ def testOptionalOperandOp():
312308@run
313309def testCustomAttribute ():
314310 with Context () as ctx :
315- test .register_python_test_dialect (ctx )
316311 a = test .TestAttr .get ()
317312 # CHECK: #python_test.test_attr
318313 print (a )
@@ -350,7 +345,6 @@ def testCustomAttribute():
350345@run
351346def testCustomType ():
352347 with Context () as ctx :
353- test .register_python_test_dialect (ctx )
354348 a = test .TestType .get ()
355349 # CHECK: !python_test.test_type
356350 print (a )
@@ -397,8 +391,6 @@ def testCustomType():
397391# CHECK-LABEL: TEST: testTensorValue
398392def testTensorValue ():
399393 with Context () as ctx , Location .unknown ():
400- test .register_python_test_dialect (ctx )
401-
402394 i8 = IntegerType .get_signless (8 )
403395
404396 class Tensor (test .TestTensorValue ):
@@ -436,7 +428,6 @@ def __str__(self):
436428@run
437429def inferReturnTypeComponents ():
438430 with Context () as ctx , Location .unknown (ctx ):
439- test .register_python_test_dialect (ctx )
440431 module = Module .create ()
441432 i32 = IntegerType .get_signless (32 )
442433 with InsertionPoint (module .body ):
@@ -488,8 +479,6 @@ def inferReturnTypeComponents():
488479@run
489480def testCustomTypeTypeCaster ():
490481 with Context () as ctx , Location .unknown ():
491- test .register_python_test_dialect (ctx )
492-
493482 a = test .TestType .get ()
494483 assert a .typeid is not None
495484
@@ -542,7 +531,6 @@ def type_caster(pytype):
542531@run
543532def testInferTypeOpInterface ():
544533 with Context () as ctx , Location .unknown (ctx ):
545- test .register_python_test_dialect (ctx )
546534 module = Module .create ()
547535 with InsertionPoint (module .body ):
548536 i64 = IntegerType .get_signless (64 )
0 commit comments