A compiler that validates and translates QIR (Quantum Intermediate Representation) to Quantinuum QIS (Quantum Instruction Set). This tool enables quantum programs written in QIR to run on Quantinuum's quantum computing systems.
- QIR Validation: Validates QIR bitcode for correctness and spec compliance
- QIS Translation: Compiles QIR to Quantinuum's native QIS instruction set
- Python & Rust API: Use as a Rust library or Python package
- CLI Tool: Command-line interface for quick compilation
See qtm-qir-reference.md for details on supported QIR features and their mapping to Quantinuum QIS.
Requirements:
- Rust >= 1.91.0
- LLVM 14
cargo build --releaseThe compiled binary will be available at target/release/qir-qis.
Requirements:
- Python >= 3.10, < 3.15
- uv (recommended) or pip
Available pre-built wheels:
- Linux: x86_64 (manylinux_2_28), aarch64 (manylinux_2_28)
- macOS: x86_64, arm64 (Apple Silicon)
- Windows: x86_64
All wheels support Python 3.10+ using the stable ABI (abi3).
# Using uv (recommended)
uv pip install qir-qis
# Using pip
pip install qir-qisFor development installation:
uv syncCompile a QIR LLVM IR file to QIS bitcode:
# Basic usage
qir-qis input.ll
# With custom optimization level
qir-qis -O 3 input.ll
# Specify target architecture
qir-qis -t x86-64 input.ll
# Or using cargo
cargo run -- input.llThis generates input.qis.bc containing the compiled QIS bitcode.
See examples/python_api.py for a complete working example.
uv run examples/python_api.pyFor a more comprehensive example with quantum simulation, see main.py.
See examples/rust_api.rs for a complete working example.
cargo run --example rust_api# Clone the repository
git clone https://github.com/quantinuum/qir-qis.git
cd qir-qis
# Install Rust dependencies and build
cargo build
# Install Python dependencies
uv sync# Build Rust binary
cargo build --release
# Build Python package
uv run maturin build --releaseTests require cargo-nextest:
# Run all tests
make test
# Or directly with cargo
cargo nextest run --all-targets --all-features# Compile a single QIR file
make compile FILE=tests/data/adaptive.ll
# Compile all test files
make allcompileTest the compiled QIS using Selene quantum simulator:
# Simulate a single file (runs 5 shots by default)
make sim FILE=tests/data/adaptive.ll
# Simulate all test files
make allsimThis will:
- Compile the QIR to QIS
- Run it on the Selene/Quest simulator
- Display measurement results
# Run linters
make lint
# This runs:
# - prek (pre-commit checks, https://prek.j178.dev/)
# - typos checker
# - cargo clippyAfter modifying the Python API:
make stubsThis updates qir_qis.pyi with the latest type signatures.
qir-qis/
├── src/
│ ├── main.rs # CLI entry point
│ ├── lib.rs # Library and Python bindings
│ ├── convert.rs # QIR to QIS conversion logic
│ ├── decompose.rs # Gate decomposition
│ ├── opt.rs # LLVM optimization passes
│ └── utils.rs # Helper utilities
├── tests/
│ ├── data/ # Test QIR files
│ └── snaps/ # Snapshot test results
├── main.py # Example Python usage with simulation
├── Cargo.toml # Rust package configuration
├── pyproject.toml # Python package configuration
└── Makefile # Common development tasks
| Command | Description |
|---|---|
make test |
Run all unit and integration tests |
make compile FILE=<path> |
Compile a single QIR file |
make sim FILE=<path> |
Compile and simulate a QIR file |
make lint |
Run code quality checks |
make stubs |
Regenerate Python type stubs |
make allcompile |
Compile all test files |
make allsim |
Simulate all test files |
Contributions are welcome! Please read CONTRIBUTING.md for:
- How to report issues and submit pull requests
- Coding standards and commit message format
- Development workflow and testing requirements
Quick checklist before submitting:
- Tests pass:
make test - Linters pass:
make lint - Documentation updated
Apache-2.0
Copyright Quantinuum