Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rrbutani/mlir-pipeline-utils
Utilities for viewing MLIR pass pipeline logs
https://github.com/rrbutani/mlir-pipeline-utils
Last synced: about 1 month ago
JSON representation
Utilities for viewing MLIR pass pipeline logs
- Host: GitHub
- URL: https://github.com/rrbutani/mlir-pipeline-utils
- Owner: rrbutani
- License: mit
- Created: 2022-11-18T01:47:32.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-19T21:17:09.000Z (11 months ago)
- Last Synced: 2024-10-15T13:33:07.598Z (3 months ago)
- Language: Rust
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `mlir-pipeline-utils`
## what
Tooling for managing the [output of `--mlir-print-ir-{before,after}-all`](https://mlir.llvm.org/docs/PassManagement/#ir-printing).
Specifically, this includes:
- a tool to split pass log output into separate MLIR files (compressing them on the way)
- a tool to step through a captured MLIR pass pipeline, with diffing## how to use?
This repo is distributed as a [nix flake](https://nixos.wiki/wiki/Flakes); currently this is the only provided usage method (but you should be able to install the required deps and build the programs in this repo manually if you'd rather not [install `nix`](https://nixos.org/download.html)).
To run without installing: `nix run github:rrbutani/mlir-pipeline-utils`.
To install: `nix profile install github:rrbutani/mlir-pipeline-utils`.### `mlir-pipeline-split` (`#split` in the flake)
> `mlir-pipeline-split []`
Reads a log file in on stdin and splits it into files within the specified output directory. Defaults to outputting to `dump` if no directory is specified.
The tool prints out passes as they are run on stderr.
i.e.:
```bash
mlir-opt example.mlir --mlir-print-ir-before-all \
|& nix run github:rrbutani/mlir-pipeline-utils#split -- example-pipeline-dump
```TODO: asciicinema
> **Warning**
> Pass output goes out on stderr which may contain other output (i.e. `llvm::errs() <<`) so the produced `.mlir.zst` files may not be semantically valid.### `mlir-pipeline-view` (`.#view` in the flake)
> `mlir-pipeline-view []`
TODO: asciicinema
> **Note**
> The viewer works best with `--mlir-print-ir-before-all --mlir-print-ir-after-all --mlir-print-ir-module-scope --mlir-disable-threading --mlir-elide-elementsattrs-if-larger=50`.
>
> The heuristics the viewer uses to correlate IR from before/after a pass in the presence of nested pass pipelines assume that both `print-ir-before-all` and `print-ir-after-all` are enabled and that the entire module is printed (TODO: maybe not?).TODO:
- allow comparing IR at arbitrary points in the pipeline!### `mlir-bat` (`.#bat` in the flake)
A [`bat`](https://github.com/sharkdp/bat) wrapper that uses [this MLIR grammar](https://github.com/rrbutani/sublime-mlir-syntax) and is `.zst` aware.
The viewer calls this internally but you can invoke this explicitly if you'd rather not install the MLIR grammar + pipe in from `zstdcat` yourself.
## anything else?
A few things:
- Untested but nothing here is particularly MLIR specific; this *should* work with the corresponding LLVM pass pipeline options.
- Works with `--mlir-print-ir-after=(...)` and `--mlir-print-ir-before=(...)` as welldevShell that has bat, etc. that's good for experimenting with stuff?