Skip to content

Commit 6bff666

Browse files
authored
Add documentation for imex-runner.py (#615)
1 parent e302bef commit 6bff666

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

docs/Tools/ImexRunner.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# imex-runner.py
2+
3+
IMEX provides an pass driver similar to mlir-opt called imex-opt. imex-opt is an extended version of mlir-opt capable of running IMEX passes. Although imex-opt is useful for testing passes it lacks a couple of user friendly feature. First, imex-opt does not have a file format for defining pass pipeline. So pass pipeline setup is passed as a usually long sequence of command line arguments. Second, imex-opt is pass driver without any other features. There are several common usage cases where imex-opt is used as part of command line pipeline like using FileCheck for checking pass outputs or using mlir-cpu-runner for testing end-to-end execution. In such common cases, it would be nice to have tool that glues things together without users to type whole chain of tools connected by pipes.
4+
imex-runner.py was designed as a tool that wraps imex-opt and other common tools to provide a simpler user experience.
5+
6+
## Features
7+
## Pass pipeline file
8+
Pass pipeline is a text file with extension .pp the allows user to save mlir pass pipeline in a text format. It is based on mlir's Textual Pass Pipeline Specification with some extensions.
9+
The format support C++ style single line comment. Add supports listing one pass name per line. The format is converted by imex-runner.py in to mlir' Textual Pass Pipeline Specification by stripping out comments and auto inserting commas. Users can use indentation along with listing one pass per line for an easier to read layout. Whitespaces are stripped automatically.
10+
### Example
11+
12+
```
13+
// Easier for users to understand pass flow and hierarchy
14+
builtin.module(inline
15+
convert-tensor-to-linalg // Some comment
16+
convert-elementwise-to-linalg
17+
// Some other comment
18+
arith-bufferize
19+
func.func(empty-tensor-to-alloc-tensor
20+
eliminate-empty-tensors
21+
scf-bufferize
22+
shape-bufferize
23+
linalg-bufferize
24+
bufferization-bufferize
25+
tensor-bufferize)
26+
func-bufferize)
27+
```
28+
29+
The Pass pipeline file will be read by imex-runner.py and will be expanded into:
30+
31+
```
32+
--pass-pipeline={builtin.module(inline,convert-tensor-to-linalg,convert-elementwise-to-linalg,arith-bufferize,func.func(empty-tensor-to-alloc-tensor,eliminate-empty-tensors,scf-bufferize,shape-bufferize,linalg-bufferize,bufferization-bufferize,tensor-bufferize),func-bufferize)}
33+
34+
```
35+
## Supporting common fixed workflow
36+
imex-runner.py supports several common workflows. The setup is running imex-opt followed by an optional runner(executing some mlir dialect on hardware) followed by an optional FileCheck utility. By opting in and out of the optional parts, user can cover common use cases like running passes with and without checking, end-to-end execution by running passes for lowering and executing though a runner with and without result checking with FileCheck.
37+
## IMEX feature based conditional execution
38+
imex-runner.py support conditional excution based on available features. Current supported features are vulkan-runner, l0-runtime, sycl-runtime.
39+
For example, if you would like imex-runner.py to execute only if vulkan-runner is available, you can do the following.
40+
```
41+
imex-runner.py --requires=vulkan-runner <rest of options>
42+
```
43+
imex-runner.py will simply exit if vulkan-runner is not available.

0 commit comments

Comments
 (0)