Work directly with textual MLIR.
Keep the source. Inspect the structure.
Section titled “Keep the source. Inspect the structure.”Zirium’s parser retains the original bytes, including comments, whitespace and malformed input. A separate semantic document resolves SSA values, types and symbols for queries, comparisons and transactional edits. Choose the representation that fits the work.
Installation
Section titled “Installation”Install the published Python package:
python -m pip install ziriumWheels cover conventional CPython 3.11–3.14 on Linux x86_64 and macOS arm64. Other platforms and free-threaded CPython are unsupported. The Python wheel does not include the CLI.
With Rust 1.88 or newer, install the published CLI:
cargo install zirium --lockedFor a Rust application, add the library with cargo add zirium and consult the
Rust API reference. The
getting-started guide covers library usage and
building from a checkout.
CLI binaries
Section titled “CLI binaries”GitHub Releases provides standalone CLI archives for Linux x86_64 (static musl) and macOS arm64. These do not require Rust, Python or LLVM. Follow the download and checksum instructions for your platform.
Try a query
Section titled “Try a query”This example reads generic MLIR from stdin and needs no dialect registry:
printf '%s\n' '"example.make"() : () -> i32' | zirium 'names | tally | json'For a file using registered custom syntax, choose a preset and use strict lowering to reject incomplete semantic information:
zirium --preset stablehlo --strict 'names | tally | json' model.mlirThe query language reference lists predicates and pipeline stages. The preset reference records which custom forms each registry supports.
Know the boundaries
Section titled “Know the boundaries”Zirium is experimental and its API may change without a migration path. Its textual syntax target is MLIR 22.1, with selected custom dialect forms. Presets support structural inspection; they do not provide complete dialect verification, type inference or execution. Bytecode and ODS/TableGen loading are unsupported.
Original output reproduces the input bytes. Formatting, canonical output and source-preserving edits each have a different contract. Read the capability reference and structural editing guide before choosing an output path.