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.4.1-cp310-abi3-win_amd64.whl (28.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

selene_hugr_qis_compiler-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl (83.6 MB view details)

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

selene_hugr_qis_compiler-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl (75.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

selene_hugr_qis_compiler-0.4.1-cp310-abi3-macosx_15_0_x86_64.whl (30.5 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

selene_hugr_qis_compiler-0.4.1-cp310-abi3-macosx_15_0_arm64.whl (29.9 MB view details)

Uploaded CPython 3.10+macOS 15.0+ ARM64

File details

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

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7bbd7a276a9432864d2ab10cff40e7d4bd3c2cd4c45e88f04e6d6fa72566297e
MD5 920e0ff19b38bf6cb8a9f602b6ed55af
BLAKE2b-256 8485971222da3e59c033db6ed4da740792e0bd80ffd92f915c6e30b0921187da

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.1-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.4.1-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bb3fe6323a223360930a8e1f215844868363d5a4e909c2a42d2876b57db0de21
MD5 cba346928064a0e1b4d8cc1d744b51ac
BLAKE2b-256 e930d259441d4fb9d20ed179fe3fbe1d2c9d81bc79b150e1e2801610dd02cd00

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.1-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.4.1-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 38530ffa39e63a4d97154ccb5acf88a9a843cfc301c45bac03fd28be0c1c3d75
MD5 08812511d45551be03281553cbc1e342
BLAKE2b-256 b38914ac3c97919969bc8322fbe40d0586962a55481b78ec246fd44bea78c91f

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.1-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.4.1-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.1-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 7979d8187543688e8b8d93d98fc185ecc733cae021feff252b5475dc9fda4b67
MD5 856868a99063c62de00bb064788de98e
BLAKE2b-256 98e47f64377ee3178bc3a46860ca3f716ec3152dc5785ba245c3ed5b260df58c

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.1-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.4.1-cp310-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.1-cp310-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 93f6bbd8650776507a913378bd777b9f2a9162826485b8137b07f8a6ba3e73d3
MD5 993de4927ed2fcbb54ee536957ca6118
BLAKE2b-256 0e9470ed255cab88aa2c93a3e4cc23f171f792e9913f13d526c7d0193c5af5dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.1-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