Name Date Size #Lines LOC

..--

CMakeLists.txtH A D28-Feb-2024624 2723

README.mdH A D28-Feb-20241.7 KiB4132

mlir-transform-opt.cppH A D11-Jan-202516 KiB390246

README.md

1# Standalone Transform Dialect Interpreter
2
3This is an example of using the Transform dialect interpreter functionality standalone, that is, outside of the regular pass pipeline. The example is a
4binary capable of processing MLIR source files similar to `mlir-opt` and other
5optimizer drivers, with the entire transformation process driven by a Transform
6dialect script. This script can be embedded into the source file or provided in
7a separate MLIR source file.
8
9Either the input module or the transform module must contain a top-level symbol
10named `__transform_main`, which is used as the entry point to the transformation
11script.
12
13```sh
14mlir-transform-opt payload_with_embedded_transform.mlir
15mlir-transform-opt payload.mlir -transform=transform.mlir
16```
17
18The name of the entry point can be overridden using command-line options.
19
20```sh
21mlir-transform-opt payload-mlir -transform-entry-point=another_entry_point
22```
23
24Transform scripts can reference symbols defined in other source files, called
25libraries, which can be supplied to the binary through command-line options.
26Libraries will be embedded into the main transformation module by the tool and
27the interpreter will process everything as a single module. A debug option is
28available to see the contents of the transform module before it goes into the interpreter.
29
30```sh
31mlir-transform-opt payload.mlir -transform=transform.mlir \
32  -transform-library=external_definitions_1.mlir \
33  -transform-library=external_definitions_2.mlir \
34  -dump-library-module
35```
36
37Check out the [Transform dialect
38tutorial](https://mlir.llvm.org/docs/Tutorials/transform/) as well as
39[documentation](https://mlir.llvm.org/docs/Dialects/Transform/) to learn more
40about the dialect.
41