Skip to main content

The HUGR-QIS compiler for Selene

This package provides compilation from HUGR to LLVM adhering to the Quantinuum QIS.

Usage

Guppy can produce a HUGR Envelope with:

from guppylang.decorator import guppy

@guppy
def main() -> None:
    # ...

hugr = main.compile()
hugr_envelope = hugr.package.to_bytes()

This can then be compiled to LLVM IR or bitcode using this package:

from qis_compiler import (
    compile_to_llvm_ir,
    compile_to_bitcode,
)

# Compile to LLVM IR for the host system
# and receive it as a string
ir = compile_to_llvm_ir(hugr_envelope)

# Compile to LLVM bitcode for the host system
# and receive it as a bytes object
bitcode = compile_to_bitcode(hugr_envelope)

If you wish to target a specific architecture or platform, you can pass the triple as an argument to the compilation functions:

# Compile to LLVM IR for Apple Silicon
ir_apple_silicon = compile_to_llvm_ir(
    hugr_envelope,
    target_triple="aarch64-apple-darwin",
)
# Compile to LLVM bitcode for x86_64 MSVC
bitcode_apple_silicon = compile_to_bitcode(
    hugr_envelope,
    target_triple="x86_64-windows-msvc",
)

Development

Snapshot testing

This package uses snapshot testing for its compiler output. Sample programs are defined using guppy in the script python/tests/generate_hugrs.py. To add a new test case add a new function to generate the desired HUGR program and call it from the if __name__ == "__main__": block.

The script has self contained dependencies with a pinned guppy version defined in comments at the top of the file. uv will create a virtual environment and install the dependencies when you run the script with uv run python tests/generate_hugrs.py. This can also be done using just regenerate in the python/tests directory.

HUGR regeneration should not be done in conjunction with other changes to the compiler, to isolate possible changes to the snapshots. It should only be required if guppylang updates are required for testing the compiler.

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.

selene_hugr_qis_compiler-0.2.11-cp310-abi3-win_amd64.whl (27.7 MB view details)

Uploaded CPython 3.10+Windows x86-64

selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_x86_64.whl (80.6 MB view details)

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

selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_aarch64.whl (73.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_x86_64.whl (29.8 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_arm64.whl (29.1 MB view details)

Uploaded CPython 3.10+macOS 15.0+ ARM64

File details

Details for the file selene_hugr_qis_compiler-0.2.11-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.2.11-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e33433a4389971d05f66aedc91f6dedb265d34ce91bcc785bdc401cf2b118429
MD5 4869c3e9392e718d1973720c59c0713f
BLAKE2b-256 0a6dab3c5107138d803141bfebacad3b26e67a10eb80155fae43ca1597265e1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.2.11-cp310-abi3-win_amd64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

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

File details

Details for the file selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9cb5080afeba4912d1507df7a3f27204605b70934bb77384e512cc9724e7833
MD5 d668dc16f4d11aea5f6681947985a235
BLAKE2b-256 7633502d28681ed33bd0a5d31d50b80b2b75144bdc4ad6b5bb1b9e706ef3de13

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

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

File details

Details for the file selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0e4506b206de8bf711bba2f2cae06cd8191f3a9c0269f73523ebdc2ed2cb17e3
MD5 721abb371fb1fcabfb1f7eedb0629858
BLAKE2b-256 0376c4d624f33e4021a203039dac1014a35d399e8b62c6625e7d84092f653ffa

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.2.11-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

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

File details

Details for the file selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 775fd24ef19e037e3bd6b21e075fd034bb21dee5ba15221a4baa7252ac129af0
MD5 89ef36b69f2167b600225214ac1a748b
BLAKE2b-256 cb37d34516be37fde9b076cdc6cbc1d6769d481900b1fde0e3f3dec8bc1eeabb

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_x86_64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

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

File details

Details for the file selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 d867c5b3bd06ec0ad09031c18ef980737b9115263581a0c211543519804b4e35
MD5 044c9917102217069cff0829073a7245
BLAKE2b-256 faced52855463d2a3f0dbca1e5556c08dcf33fa231bff98fc5566ba82af9f1a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.2.11-cp310-abi3-macosx_15_0_arm64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

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 Sentry Error logging StatusPage Status page