Revert "[MLIR][Transform][Python] transform.foreach wrapper and .owner OpViews" (#172225)

Reverts llvm/llvm-project#171544 ; bots are broken.
This commit is contained in:
Mehdi Amini
2025-12-14 22:27:02 +01:00
committed by GitHub
parent bcbbe2c2bc
commit b9fe6532a7
4 changed files with 6 additions and 107 deletions

View File

@@ -14,7 +14,8 @@ from ..ir import Value, MemRefType, StridedLayoutAttr, ShapedType, Operation
def _is_constant_int_like(i):
return (
isinstance(i, Value)
and isinstance(i.owner, ConstantOp)
and isinstance(i.owner, Operation)
and isinstance(i.owner.opview, ConstantOp)
and _is_integer_like_type(i.type)
)

View File

@@ -310,8 +310,6 @@ class NamedSequenceOp(NamedSequenceOp):
sym_visibility=sym_visibility,
arg_attrs=arg_attrs,
res_attrs=res_attrs,
loc=loc,
ip=ip,
)
self.regions[0].blocks.append(*input_types)
@@ -470,54 +468,6 @@ def apply_registered_pass(
).result
@_ods_cext.register_operation(_Dialect, replace=True)
class ForeachOp(ForeachOp):
def __init__(
self,
results: Sequence[Type],
targets: Sequence[Union[Operation, Value, OpView]],
*,
with_zip_shortest: Optional[bool] = False,
loc=None,
ip=None,
):
targets = [_get_op_result_or_value(target) for target in targets]
super().__init__(
results_=results,
targets=targets,
with_zip_shortest=with_zip_shortest,
loc=loc,
ip=ip,
)
self.regions[0].blocks.append(*[target.type for target in targets])
@property
def body(self) -> Block:
return self.regions[0].blocks[0]
@property
def bodyTargets(self) -> BlockArgumentList:
return self.regions[0].blocks[0].arguments
def foreach(
results: Sequence[Type],
targets: Sequence[Union[Operation, Value, OpView]],
*,
with_zip_shortest: Optional[bool] = False,
loc=None,
ip=None,
) -> Union[OpResult, OpResultList, ForeachOp]:
results = ForeachOp(
results=results,
targets=targets,
with_zip_shortest=with_zip_shortest,
loc=loc,
ip=ip,
).results
return results if len(results) > 1 else (results[0] if len(results) == 1 else op)
AnyOpTypeT = NewType("AnyOpType", AnyOpType)