[mlir] Allow Tile transform op to take dynamic sizes

Extend the definition of the Tile structured transform op to enable it
accepting handles to operations that produce tile sizes at runtime. This is
useful by itself and prepares for more advanced tiling strategies. Note that
the changes are relevant only to the transform dialect, the tiling
transformation itself already supports dynamic sizes.

Depends On D129216

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D129217
This commit is contained in:
Alex Zinenko
2022-07-07 15:55:44 +02:00
parent 7b69843f0b
commit 4e4a4c0576
12 changed files with 296 additions and 66 deletions

View File

@@ -105,9 +105,8 @@ def testTileCompact():
transform.YieldOp()
# CHECK-LABEL: TEST: testTileCompact
# CHECK: transform.sequence
# CHECK: %{{.+}}, %{{.+}}:2 = transform.structured.tile
# CHECK-DAG: interchange = [0, 1]
# CHECK-DAG: sizes = [4, 8]
# CHECK: %{{.+}}, %{{.+}}:2 = transform.structured.tile %{{.*}}[4, 8]
# CHECK: interchange = [0, 1]
@run
@@ -122,9 +121,8 @@ def testTileAttributes():
transform.YieldOp()
# CHECK-LABEL: TEST: testTileAttributes
# CHECK: transform.sequence
# CHECK: structured.tile
# CHECK-DAG: interchange = [0, 1]
# CHECK-DAG: sizes = [4, 8]
# CHECK: %{{.+}}, %{{.+}}:2 = transform.structured.tile %{{.*}}[4, 8]
# CHECK: interchange = [0, 1]
@run
@@ -136,9 +134,24 @@ def testTileZero():
transform.YieldOp()
# CHECK-LABEL: TEST: testTileZero
# CHECK: transform.sequence
# CHECK: %{{.+}}, %{{.+}}:2 = transform.structured.tile
# CHECK-DAG: interchange = [0, 1, 2, 3]
# CHECK-DAG: sizes = [4, 0, 2, 0]
# CHECK: %{{.+}}, %{{.+}}:2 = transform.structured.tile %{{.*}}[4, 0, 2, 0]
# CHECK: interchange = [0, 1, 2, 3]
@run
def testTileDynamic():
with_pdl = transform.WithPDLPatternsOp()
with InsertionPoint(with_pdl.body):
sequence = transform.SequenceOp(with_pdl.bodyTarget)
with InsertionPoint(sequence.body):
m1 = transform.PDLMatchOp(sequence.bodyTarget, "first")
m2 = transform.PDLMatchOp(sequence.bodyTarget, "second")
structured.TileOp(sequence.bodyTarget, sizes=[m1, 3, m2, 0])
transform.YieldOp()
# CHECK-LABEL: TEST: testTileDynamic
# CHECK: %[[FIRST:.+]] = pdl_match
# CHECK: %[[SECOND:.+]] = pdl_match
# CHECK: %{{.+}}, %{{.+}}:3 = transform.structured.tile %{{.*}}[%[[FIRST]], 3, %[[SECOND]], 0]
@run