[MLIR][Python] Ensure traits are attached when load(register=False) (#181174)
Currently, when calling `.load(register=False)`, `op._attach_traits()` isn’t executed. This PR ensures traits are attached regardless of whether `register` is `True` or `False`.
This commit is contained in:
parent
b4e4616342
commit
16ef4ed48f
@ -27,17 +27,18 @@ ir = _cext.ir
|
||||
|
||||
__all__ = [
|
||||
"Dialect",
|
||||
"Operation",
|
||||
"Operand",
|
||||
"Result",
|
||||
"Region",
|
||||
"register_dialect",
|
||||
"register_operation",
|
||||
"Region",
|
||||
"Operation",
|
||||
]
|
||||
|
||||
Operand = ir.Value
|
||||
Result = ir.OpResult
|
||||
Region = ir.Region
|
||||
|
||||
register_dialect = _cext.register_dialect
|
||||
register_operation = _cext.register_operation
|
||||
|
||||
@ -528,10 +529,12 @@ class Dialect(ir.Dialect):
|
||||
|
||||
irdl.load_dialects(cls._mlir_module)
|
||||
|
||||
for op in cls.operations:
|
||||
op._attach_traits()
|
||||
|
||||
if register:
|
||||
register_dialect(cls)
|
||||
|
||||
register_dialect_operation = register_operation(cls)
|
||||
for op in cls.operations:
|
||||
op._attach_traits()
|
||||
register_dialect_operation(op)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user