Work in progress: Niro is at an early stage and is not yet ready for production use. Pull requests may be rejected while the design is still taking shape.
The goal of Niro is to compile computation graphs from ONNX, TensorFlow, PyTorch, and other frontends through one unified SSA IR. The initial target is MLIR, primarily using xDSL. Future backends may include WebAssembly, GIMPLE, and others.
The Niro IR is described in docs/ir.md.
Emit textual MLIR to standard output:
niro emit mlir model.onnxUse -o to write it to a file:
niro emit mlir model.onnx -o model.mlirNiro infers the input format from recognized file extensions. Specify it when reading from standard input:
niro emit mlir --input-format onnx < model.onnx | mlir-optRun the local CI checks with:
nix run .#ciWe want the project to remain small, direct, and easy to understand without compromising correctness or output quality. When contributing:
- Prefer simple designs that model the required semantics precisely over speculative abstractions.
- Use type hints throughout Python code.
- Keep the core IR independent of any single frontend or backend.
- Establish invariants at construction time, derive redundant information, so downstream code can trust constructed values.
- Keep code compact and minimal without sacrificing clarity or required behavior.
- Add tests for meaningful behavior and invariants.
- Keep documentation concise, and try to introduce concepts before relying on them.