168ae0d78SAlex Zinenko# Transform Dialect Tutorial 268ae0d78SAlex Zinenko 368ae0d78SAlex ZinenkoMLIR supports declarative specification for controlling compiler transformations 468ae0d78SAlex Zinenkovia the transform dialect. It allows one to request compiler transformations 568ae0d78SAlex Zinenkousing compiler IR itself, which can be embedded into the original IR that is 668ae0d78SAlex Zinenkobeing transformed (similarly to pragmas) or supplied separately (similarly to 768ae0d78SAlex Zinenkoscheduling languages). This tutorial presents the concepts of the MLIR transform 868ae0d78SAlex Zinenkodialect and related infrastructure. It will be accompanied by a practical 968ae0d78SAlex Zinenkodemonstration of three use scenarios: 1068ae0d78SAlex Zinenko 1139298b09SAndrzej Warzyński- Composing Transform dialect operations available in (upstream) MLIR to perform 1268ae0d78SAlex Zinenko a sequence of optimizing transformations that results in efficient code for an 1368ae0d78SAlex Zinenko MLIR linear algebra operation. 1439298b09SAndrzej Warzyński- Defining new Transform dialect operations and adapting existing transformation 1539298b09SAndrzej Warzyński code to work with the Transform dialect infrastructure. 1639298b09SAndrzej Warzyński- Setting up and using the Transform dialect infrastructure in a downstream 1768ae0d78SAlex Zinenko out-of-tree project with custom dialects, transformations and passes. 1868ae0d78SAlex Zinenko 1939298b09SAndrzej WarzyńskiAfter following the tutorial, one will be able to apply the Transform dialect in 2068ae0d78SAlex Zinenkotheir work and extend it when necessary. Basic familiarity with MLIR is a 2168ae0d78SAlex Zinenkoprerequisite. See [Toy tutorial](../Toy) for introduction to MLIR. 2268ae0d78SAlex Zinenko 2368ae0d78SAlex ZinenkoThe tutorial is divided into the following chapters. 2468ae0d78SAlex Zinenko 2568ae0d78SAlex Zinenko- [Chapter #0](Ch0.md): A Primer on “Structured” Linalg Operations 2668ae0d78SAlex Zinenko- [Chapter #1](Ch1.md): Combining Existing Transformations 2768ae0d78SAlex Zinenko- [Chapter #2](Ch2.md): Adding a Simple New Transformation Operation 2868ae0d78SAlex Zinenko- [Chapter #3](Ch3.md): More than Simple Transform Operations 29*4cb2ef4fSOleksandr "Alex" Zinenko- [Chapter #4](Ch4.md): Matching Payload with Transform Operations 306841eff1SOleksandr "Alex" Zinenko- [Chapter H](ChH.md): Reproducing Halide Schedule 3168ae0d78SAlex Zinenko 3268ae0d78SAlex ZinenkoThe code corresponding to this tutorial is located under 3368ae0d78SAlex Zinenko`mlir/Examples/transform` and the corresponding tests in 3468ae0d78SAlex Zinenko`mlir/test/Examples/transform`. 35