[mlir] expose transform dialect symbol merge to python (#87690)

This functionality is available in C++, make it available in Python
directly to operate on transform modules.
This commit is contained in:
Oleksandr "Alex" Zinenko
2024-04-17 15:01:59 +02:00
committed by GitHub
parent 971ec1f0ee
commit 73140daebb
5 changed files with 120 additions and 2 deletions

View File

@@ -5,7 +5,6 @@
from ....ir import Operation
from ...._mlir_libs import _mlirTransformInterpreter as _cextTransformInterpreter
TransformOptions = _cextTransformInterpreter.TransformOptions
@@ -31,3 +30,12 @@ def apply_named_sequence(
_cextTransformInterpreter.apply_named_sequence(*args)
else:
_cextTransformInterpreter(*args, transform_options)
def copy_symbols_and_merge_into(target, other):
"""Copies symbols from other into target, renaming private symbols to avoid
duplicates. Raises an error if copying would lead to duplicate public
symbols."""
_cextTransformInterpreter.copy_symbols_and_merge_into(
_unpack_operation(target), _unpack_operation(other)
)