[all-commits] [llvm/llvm-project] 9ad5da: [mlir][Pass] Add new FileTreeIRPrinterConfig (#67840)

Christopher Bate via All-commits all-commits at lists.llvm.org
Fri May 24 09:02:10 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ad5da2defd4f88c6649bf2b77f1968f661f2dcc
      https://github.com/llvm/llvm-project/commit/9ad5da2defd4f88c6649bf2b77f1968f661f2dcc
  Author: Christopher Bate <cbate at nvidia.com>
  Date:   2024-05-24 (Fri, 24 May 2024)

  Changed paths:
    M mlir/docs/PassManagement.md
    M mlir/include/mlir/Pass/PassManager.h
    M mlir/lib/Pass/IRPrinting.cpp
    M mlir/lib/Pass/PassManagerOptions.cpp
    A mlir/test/Pass/ir-printing-file-tree.mlir

  Log Message:
  -----------
  [mlir][Pass] Add new FileTreeIRPrinterConfig (#67840)

This change expands the existing instrumentation that prints the IR
before/after each pass to an output stream (usually stderr). It adds
a new configuration that will print the output of each pass to a
separate file. The files will be organized into a directory tree
rooted at a specified directory. For existing tools, a CL option
`-mlir-print-ir-tree-dir` is added to specify this directory and
activate the new printing config.

The created directory tree mirrors the nesting structure of the IR. For
example,
if the IR is congruent to the pass-pipeline
"builtin.module(pass1,pass2,func.func(pass3,pass4),pass5)", and
`-mlir-print-ir-tree-dir=/tmp/pipeline_output`, then then the tree file
tree
created will look like:

```
/tmp/pass_output
├── builtin_module_the_symbol_name
│   ├── 0_pass1.mlir
│   ├── 1_pass2.mlir
│   ├── 2_pass5.mlir
│   ├── func_func_my_func_name
│   │   ├── 1_0_pass3.mlir
│   │   ├── 1_1_pass4.mlir
│   ├── func_func_my_other_func_name
│   │   ├── 1_0_pass3.mlir
│   │   ├── 1_1_pass4.mlir
```

The subdirectories are named by concatenating the relevant parent
operation names and symbol name (if present). The printer keeps a
counter associated with ops that are targeted by passes and their
isolated-from-above parents. Each filename is given a numeric prefix
using the counter value for the op that the pass is targeting and then
prepending the counter values for each parent. This gives a naming
where it is easy to distinguish which passes may have run concurrently
vs. which have a clear ordering. In the above example, for both
`1_1_pass4.mlir` files, the first `1` refers to the counter for the
parent op, and the second refers to the counter for the respective
function.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list