Skip to content

Commit 4c654b7

Browse files
authored
[MLIR][Python] Add missing peel_front argument to LoopPeelOp's extension class (#81424)
1 parent 5fdd094 commit 4c654b7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

mlir/python/mlir/dialects/transform/loop.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(
5555
remainder_loop_type: Type,
5656
target: Union[Operation, Value],
5757
*,
58+
peel_front: Union[bool, BoolAttr] = False,
5859
fail_if_already_divisible: Union[bool, BoolAttr] = False,
5960
ip=None,
6061
loc=None,
@@ -63,6 +64,11 @@ def __init__(
6364
main_loop_type,
6465
remainder_loop_type,
6566
_get_op_result_or_value(target),
67+
peel_front=(
68+
peel_front
69+
if isinstance(peel_front, BoolAttr)
70+
else BoolAttr.get(peel_front)
71+
),
6672
fail_if_already_divisible=(
6773
fail_if_already_divisible
6874
if isinstance(fail_if_already_divisible, BoolAttr)

mlir/test/python/dialects/transform_loop_ext.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ def loopPeel():
4949
# CHECK-LABEL: TEST: loopPeel
5050
# CHECK: = transform.loop.peel %
5151

52+
@run
53+
def loopPeel_peel_front():
54+
sequence = transform.SequenceOp(
55+
transform.FailurePropagationMode.Propagate,
56+
[],
57+
transform.OperationType.get("scf.for"),
58+
)
59+
with InsertionPoint(sequence.body):
60+
loop.LoopPeelOp(
61+
transform.AnyOpType.get(),
62+
transform.AnyOpType.get(),
63+
sequence.bodyTarget,
64+
peel_front=True,
65+
)
66+
transform.YieldOp()
67+
# CHECK-LABEL: TEST: loopPeel_peel_front
68+
# CHECK: = transform.loop.peel %[[ARG0:.*]] {peel_front = true}
69+
5270

5371
@run
5472
def loopPipeline():

0 commit comments

Comments
 (0)