Introduce two different failure propagation mode in the Transform
dialect's Sequence operation. These modes specify whether silenceable
errors produced by nested ops are immediately propagated, thus stopping
the sequence, or suppressed. The latter is useful in end-to-end
transform application scenarios where the user cannot correct the
transformation, but it is robust enough to silenceable failures. It
can be combined with the "alternatives" operation. There is
intentionally no default value to avoid favoring one mode over the
other.
Downstreams can update their tests using:
S='s/sequence \(%.*\) {/sequence \1 failures(propagate) {/'
T='s/sequence {/sequence failures(propagate) {/'
git grep -l transform.sequence | xargs sed -i -e "$S"
git grep -l transform.sequence | xargs sed -i -e "$T"
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D131774
72 lines
1.9 KiB
Python
72 lines
1.9 KiB
Python
# RUN: %PYTHON %s | FileCheck %s
|
|
|
|
from mlir.ir import *
|
|
from mlir.dialects import transform
|
|
from mlir.dialects import pdl
|
|
from mlir.dialects.transform import loop
|
|
|
|
|
|
def run(f):
|
|
with Context(), Location.unknown():
|
|
module = Module.create()
|
|
with InsertionPoint(module.body):
|
|
print("\nTEST:", f.__name__)
|
|
f()
|
|
print(module)
|
|
return f
|
|
|
|
|
|
@run
|
|
def getParentLoop():
|
|
sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
|
|
with InsertionPoint(sequence.body):
|
|
loop.GetParentForOp(sequence.bodyTarget, num_loops=2)
|
|
transform.YieldOp()
|
|
# CHECK-LABEL: TEST: getParentLoop
|
|
# CHECK: = transform.loop.get_parent_for %
|
|
# CHECK: num_loops = 2
|
|
|
|
|
|
@run
|
|
def loopOutline():
|
|
sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
|
|
with InsertionPoint(sequence.body):
|
|
loop.LoopOutlineOp(sequence.bodyTarget, func_name="foo")
|
|
transform.YieldOp()
|
|
# CHECK-LABEL: TEST: loopOutline
|
|
# CHECK: = transform.loop.outline %
|
|
# CHECK: func_name = "foo"
|
|
|
|
|
|
@run
|
|
def loopPeel():
|
|
sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
|
|
with InsertionPoint(sequence.body):
|
|
loop.LoopPeelOp(sequence.bodyTarget)
|
|
transform.YieldOp()
|
|
# CHECK-LABEL: TEST: loopPeel
|
|
# CHECK: = transform.loop.peel %
|
|
|
|
|
|
@run
|
|
def loopPipeline():
|
|
sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
|
|
with InsertionPoint(sequence.body):
|
|
loop.LoopPipelineOp(sequence.bodyTarget, iteration_interval=3)
|
|
transform.YieldOp()
|
|
# CHECK-LABEL: TEST: loopPipeline
|
|
# CHECK: = transform.loop.pipeline %
|
|
# CHECK-DAG: iteration_interval = 3
|
|
# CHECK-DAG: read_latency = 10
|
|
|
|
|
|
@run
|
|
def loopUnroll():
|
|
sequence = transform.SequenceOp(transform.FailurePropagationMode.PROPAGATE)
|
|
with InsertionPoint(sequence.body):
|
|
loop.LoopUnrollOp(sequence.bodyTarget, factor=42)
|
|
transform.YieldOp()
|
|
# CHECK-LABEL: TEST: loopUnroll
|
|
# CHECK: transform.loop.unroll %
|
|
# CHECK: factor = 42
|