Skip to main content

QIR to Quantinuum QIS (Quantum Instruction Set) compiler

Project description

QIR-QIS

Crates.io PyPI

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.

Features

  • 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.

Installation

From Source (Rust)

Requirements:

  • Rust >= 1.91.0
  • LLVM 21
# Point llvm-sys to your LLVM 21 installation
export LLVM_SYS_211_PREFIX=/path/to/llvm21

cargo build --release

The compiled binary will be available at target/release/qir-qis.

Python Package

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-qis

Usage

Command Line

Compile 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.ll

This generates input.qis.bc containing the compiled QIS bitcode.

On Windows, the default mode is conservative: -O 0 -t native. Optimized conversion paths remain temporarily disabled there because the current LLVM 21 integration can crash in those modes.

Python API

See examples/python_api.py for a complete working example.

uv run examples/python_api.py

For a more comprehensive example with quantum simulation, see main.py.

Rust API

See examples/rust_api.rs for a complete working example.

cargo run --example rust_api

Platform Notes

Windows support is functional, but a few LLVM integration paths still differ from Linux and macOS:

  • Optimized conversion currently fails fast on Windows with a clear error instead of entering the known unstable LLVM path.
  • LLVM verifier failures return a generic error on Windows instead of the full verifier message.
  • Native target codegen on Windows uses conservative CPU settings instead of host CPU feature detection.
  • -O0 optimization on Windows is a validation-only fast path and does not rewrite the module triple.

These limitations are implementation details of the current LLVM/Inkwell integration rather than QIR feature differences.

Contributing

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

Development setup, test commands, and LLVM upgrade guidance live in DEVELOPMENT.md. Release notes are available in CHANGELOG.md.

License

Apache-2.0

Copyright Quantinuum

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qir_qis-0.1.5-cp310-abi3-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

qir_qis-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl (26.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

qir_qis-0.1.5-cp310-abi3-manylinux_2_34_aarch64.whl (28.7 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ ARM64

qir_qis-0.1.5-cp310-abi3-macosx_15_0_x86_64.whl (23.2 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

qir_qis-0.1.5-cp310-abi3-macosx_15_0_arm64.whl (21.9 MB view details)

Uploaded CPython 3.10+macOS 15.0+ ARM64

File details

Details for the file qir_qis-0.1.5-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: qir_qis-0.1.5-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qir_qis-0.1.5-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cbb84fc9a56dc6a4a7c7365ac0c6e3a4d51a15c1c1bfb9504763ea6aba58ff1c
MD5 455d445dd11b0596f8f1d27ee68c0876
BLAKE2b-256 8eb13b39a9bd389c1535a5fc4aaff8f20e79d79acb39bf606e7b023165b842dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for qir_qis-0.1.5-cp310-abi3-win_amd64.whl:

Publisher: wheels-release.yml on Quantinuum/qir-qis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qir_qis-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for qir_qis-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3ba9f75275aaef1035eeae241b2e7ed2f0f9a70ffddef7edaf77659339333b00
MD5 5b8d2824ba0f13ec8da3ff3a9941bac9
BLAKE2b-256 73dacb1bd2964a0d6d1c16357d44264faa617c2834529deb02b0853cb2ebb2c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for qir_qis-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl:

Publisher: wheels-release.yml on Quantinuum/qir-qis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qir_qis-0.1.5-cp310-abi3-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for qir_qis-0.1.5-cp310-abi3-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 195d2009e3637280765c1078395d630ff2da5697c64391316b092365ffbde530
MD5 889a338b0e0ca71c593ac65f815218a4
BLAKE2b-256 4cfecb3b39507dc99eebdc79dd947254c53979de936624c4146a217f9bdd0146

See more details on using hashes here.

Provenance

The following attestation bundles were made for qir_qis-0.1.5-cp310-abi3-manylinux_2_34_aarch64.whl:

Publisher: wheels-release.yml on Quantinuum/qir-qis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qir_qis-0.1.5-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for qir_qis-0.1.5-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 33335b6e0c247ce2918f97959de429ef7300e8ad1e71669fee10c0302bbb7f79
MD5 699cbf9a057f300ca7de014100e7db0c
BLAKE2b-256 bcdb19743834202796cfa8597c630c314ff751675f22268bf2393b2c0ebd82df

See more details on using hashes here.

Provenance

The following attestation bundles were made for qir_qis-0.1.5-cp310-abi3-macosx_15_0_x86_64.whl:

Publisher: wheels-release.yml on Quantinuum/qir-qis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qir_qis-0.1.5-cp310-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for qir_qis-0.1.5-cp310-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8ca9f36e15fd23680192c50929099c136bfdee36deb57851ec800e0ab871ff90
MD5 cad27a6f0828eab46e54f64c31a93bd7
BLAKE2b-256 50d87e87e91077771e07532395d37233a94579ac610251e86a2715edd83eed06

See more details on using hashes here.

Provenance

The following attestation bundles were made for qir_qis-0.1.5-cp310-abi3-macosx_15_0_arm64.whl:

Publisher: wheels-release.yml on Quantinuum/qir-qis

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page