-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Due to the LLVM dependency the package is excluded from default CI runs, except check which does not require llvm. A separate job for building and testing is added that runs on push to main.
- Loading branch information
Showing
158 changed files
with
11,478 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/snapshots/*.snap -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,7 @@ python: | |
- "uv.lock" | ||
- "specification/schema/**" | ||
- ".github/workflows/ci-py.yml" | ||
|
||
|
||
llvm: | ||
- "hugr-llvm/**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
- main | ||
pull_request: | ||
branches: | ||
- main | ||
- '*' | ||
merge_group: | ||
types: [checks_requested] | ||
workflow_dispatch: {} | ||
|
@@ -23,7 +23,7 @@ env: | |
|
||
jobs: | ||
# Check if changes were made to the relevant files. | ||
# Always returns true if running on the default branch, to ensure all changes are throughly checked. | ||
# Always returns true if running on the default branch, to ensure all changes are thoroughly checked. | ||
changes: | ||
name: Check for changes | ||
runs-on: ubuntu-latest | ||
|
@@ -35,6 +35,7 @@ jobs: | |
outputs: | ||
rust: ${{ steps.filter.outputs.rust == 'true' || steps.override.outputs.out == 'true' }} | ||
python: ${{ steps.filter.outputs.python == 'true' || steps.override.outputs.out == 'true' }} | ||
llvm: ${{ steps.filter.outputs.llvm == 'true' || steps.override.outputs.out == 'true' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Override label | ||
|
@@ -91,9 +92,9 @@ jobs: | |
- name: Install CapnProto | ||
run: sudo apt-get install -y capnproto | ||
- name: Build benchmarks with no features | ||
run: cargo bench --verbose --no-run --workspace --no-default-features | ||
run: cargo bench --verbose --no-run --no-default-features | ||
- name: Build benchmarks with all features | ||
run: cargo bench --verbose --no-run --workspace --all-features | ||
run: cargo bench --verbose --no-run --all-features | ||
|
||
# Run tests on Rust stable | ||
tests-stable-no-features: | ||
|
@@ -110,12 +111,13 @@ jobs: | |
toolchain: "stable" | ||
- name: Configure default rust toolchain | ||
run: rustup override set ${{steps.toolchain.outputs.name}} | ||
|
||
- name: Install CapnProto | ||
run: sudo apt-get install -y capnproto | ||
- name: Build with no features | ||
run: cargo test --verbose --workspace --no-default-features --no-run | ||
run: cargo test --verbose --no-default-features --no-run | ||
- name: Tests with no features | ||
run: cargo test --verbose --workspace --no-default-features | ||
run: cargo test --verbose --no-default-features | ||
|
||
# Run tests on Rust stable | ||
tests-stable-all-features: | ||
|
@@ -132,12 +134,13 @@ jobs: | |
toolchain: "stable" | ||
- name: Configure default rust toolchain | ||
run: rustup override set ${{steps.toolchain.outputs.name}} | ||
|
||
- name: Install CapnProto | ||
run: sudo apt-get install -y capnproto | ||
- name: Build with all features | ||
run: cargo test --verbose --workspace --all-features --no-run | ||
run: cargo test --verbose --all-features --no-run | ||
- name: Tests with all features | ||
run: cargo test --verbose --workspace --all-features | ||
run: cargo test --verbose --all-features | ||
- name: Build HUGR binary | ||
run: cargo build -p hugr-cli | ||
- name: Upload the binary to the artifacts | ||
|
@@ -170,13 +173,13 @@ jobs: | |
- name: Install CapnProto | ||
run: sudo apt-get install -y capnproto | ||
- name: Build with no features | ||
run: cargo test --verbose --workspace --no-default-features --no-run | ||
run: cargo test --verbose --no-default-features --no-run | ||
- name: Tests with no features | ||
run: cargo test --verbose --workspace --no-default-features | ||
run: cargo test --verbose --no-default-features | ||
- name: Build with all features | ||
run: cargo test --verbose --workspace --all-features --no-run | ||
run: cargo test --verbose --all-features --no-run | ||
- name: Tests with all features | ||
run: cargo test --verbose --workspace --all-features | ||
run: cargo test --verbose --all-features | ||
|
||
# Ensure that serialized extensions match rust implementation | ||
std-extensions: | ||
|
@@ -225,8 +228,8 @@ jobs: | |
- name: Run tests with coverage instrumentation | ||
run: | | ||
cargo llvm-cov clean --workspace | ||
cargo llvm-cov --no-report --workspace --no-default-features --doctests | ||
cargo llvm-cov --no-report --workspace --all-features --doctests | ||
cargo llvm-cov --no-report --no-default-features --doctests | ||
cargo llvm-cov --no-report --all-features --doctests | ||
- name: Generate coverage report | ||
run: cargo llvm-cov --all-features report --codecov --output-path coverage.json | ||
- name: Upload coverage to codecov.io | ||
|
@@ -237,6 +240,39 @@ jobs: | |
flags: rust | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
tests-stable-llvm: | ||
needs: changes | ||
if: ${{ ( needs.changes.outputs.llvm == 'true' && github.event_name == 'push' ) || needs.changes.outputs.override == 'true' }} | ||
runs-on: ubuntu-latest | ||
name: tests hugr-llvm | ||
strategy: | ||
matrix: | ||
llvm-version: | ||
# different strings for install action and feature name | ||
# adapted from https://github.com/TheDan64/inkwell/blob/master/.github/workflows/test.yml | ||
- ["14.0", "14-0"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: mozilla-actions/[email protected] | ||
- id: toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: "stable" | ||
- name: Configure default rust toolchain | ||
run: rustup override set ${{steps.toolchain.outputs.name}} | ||
- name: Install CapnProto | ||
run: sudo apt-get install -y capnproto | ||
- name: Install LLVM and Clang | ||
uses: KyleMayes/install-llvm-action@v2 | ||
with: | ||
version: ${{ matrix.llvm-version[0] }} | ||
env: true | ||
- name: Build | ||
run: cargo test -p hugr-llvm --verbose --features llvm${{ matrix.llvm-version[1] }} --no-run | ||
- name: Tests with no features | ||
run: cargo test -p hugr-llvm --verbose --features llvm${{ matrix.llvm-version[1] }} | ||
|
||
rs-semver-checks: | ||
needs: [changes, check] | ||
if: ${{ needs.changes.outputs.rust == 'true' && github.event_name == 'pull_request' }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
## [0.13.3](https://github.com/CQCL/hugr-llvm/compare/v0.6.0...v0.6.1) - 2024-11-25 | ||
No changes - version bump to catch up with other hugr crates in repository move. | ||
|
||
## [0.6.1](https://github.com/CQCL/hugr-llvm/compare/v0.6.0...v0.6.1) - 2024-10-23 | ||
|
||
### Bug Fixes | ||
|
||
- don't normalise half turns ([#137](https://github.com/CQCL/hugr-llvm/pull/137)) | ||
|
||
## [0.6.0](https://github.com/CQCL/hugr-llvm/compare/v0.5.1...v0.6.0) - 2024-10-21 | ||
|
||
### Bug Fixes | ||
|
||
- Conversion operations having poison results ([#131](https://github.com/CQCL/hugr-llvm/pull/131)) | ||
|
||
### New Features | ||
|
||
- [**breaking**] Allow extension callbacks to have non-`'static` lifetimes ([#128](https://github.com/CQCL/hugr-llvm/pull/128)) | ||
- [**breaking**] Support `tket2.rotation.from_halfturns_unchecked` ([#133](https://github.com/CQCL/hugr-llvm/pull/133)) | ||
|
||
### Refactor | ||
|
||
- [**breaking**] remove trait emit op ([#104](https://github.com/CQCL/hugr-llvm/pull/104)) | ||
- [**breaking**] rework extensions interface ([#119](https://github.com/CQCL/hugr-llvm/pull/119)) | ||
- [**breaking**] move packaged extensions from `crate::custom` to `crate::extension` ([#126](https://github.com/CQCL/hugr-llvm/pull/126)) | ||
|
||
## [0.5.1](https://github.com/CQCL/hugr-llvm/compare/v0.5.0...v0.5.1) - 2024-09-23 | ||
|
||
### New Features | ||
|
||
- provide `inline_constant_functions` ([#108](https://github.com/CQCL/hugr-llvm/pull/108)) | ||
|
||
## [0.5.0](https://github.com/CQCL/hugr-llvm/compare/v0.4.0...v0.5.0) - 2024-09-16 | ||
|
||
### New Features | ||
|
||
- Add emitters for int <-> float/usize conversions ([#94](https://github.com/CQCL/hugr-llvm/pull/94)) | ||
- [**breaking**] array ops ([#96](https://github.com/CQCL/hugr-llvm/pull/96)) | ||
- Add conversions itobool, ifrombool ([#101](https://github.com/CQCL/hugr-llvm/pull/101)) | ||
- Add `tket2` feature and lowerings for `tket2.rotation` extension ([#100](https://github.com/CQCL/hugr-llvm/pull/100)) | ||
|
||
### Testing | ||
|
||
- Add execution test framework ([#97](https://github.com/CQCL/hugr-llvm/pull/97)) | ||
|
||
## [0.3.1](https://github.com/CQCL/hugr-llvm/compare/v0.3.0...v0.3.1) - 2024-08-28 | ||
|
||
### New Features | ||
- Emit more int operations ([#87](https://github.com/CQCL/hugr-llvm/pull/87)) | ||
|
||
## [0.3.0](https://github.com/CQCL/hugr-llvm/compare/v0.2.1...v0.3.0) - 2024-08-27 | ||
|
||
### New Features | ||
- [**breaking**] Lower string, print, and panic ([#78](https://github.com/CQCL/hugr-llvm/pull/78)) | ||
- Lower float operations ([#83](https://github.com/CQCL/hugr-llvm/pull/83)) | ||
- Lower logic extension ([#81](https://github.com/CQCL/hugr-llvm/pull/81)) | ||
- Lower arrays ([#82](https://github.com/CQCL/hugr-llvm/pull/82)) | ||
|
||
## [0.2.1](https://github.com/CQCL/hugr-llvm/compare/v0.2.0...v0.2.1) - 2024-08-19 | ||
|
||
### Documentation | ||
- Remove fixed crate version in usage instructions ([#68](https://github.com/CQCL/hugr-llvm/pull/68)) | ||
|
||
### New Features | ||
- Add lowering for LoadFunction ([#65](https://github.com/CQCL/hugr-llvm/pull/65)) | ||
- Emission for CallIndirect nodes ([#73](https://github.com/CQCL/hugr-llvm/pull/73)) | ||
|
||
## [0.2.0](https://github.com/CQCL/hugr-llvm/compare/v0.1.0...v0.2.0) - 2024-07-31 | ||
|
||
### New Features | ||
- make EmitFuncContext::iw_context pub ([#55](https://github.com/CQCL/hugr-llvm/pull/55)) | ||
|
||
### Refactor | ||
- use HugrFuncType/HugrType/HugrSumType ([#56](https://github.com/CQCL/hugr-llvm/pull/56)) | ||
- remove unneeded `HugrView` constraints ([#59](https://github.com/CQCL/hugr-llvm/pull/59)) | ||
- [**breaking**] add `LLVMSumValue` ([#63](https://github.com/CQCL/hugr-llvm/pull/63)) | ||
|
||
### Testing | ||
- Add test for LoadFunction Op ([#60](https://github.com/CQCL/hugr-llvm/pull/60)) | ||
|
||
## [0.1.0](https://github.com/CQCL/hugr-llvm/releases/tag/v0.1.0) - 2024-07-10 | ||
|
||
### Bug Fixes | ||
- Syntax error | ||
- sum type tag elision logic reversed | ||
- [**breaking**] Allow Const and FuncDecl as children of Modules, Dataflow Parents, and CFG nodes ([#46](https://github.com/CQCL/hugr-llvm/pull/46)) | ||
|
||
### Documentation | ||
- fix bad grammar ([#34](https://github.com/CQCL/hugr-llvm/pull/34)) | ||
|
||
### New Features | ||
- Emission for Call nodes | ||
- Support values | ||
- add `get_extern_func` ([#28](https://github.com/CQCL/hugr-llvm/pull/28)) | ||
- lower CFGs ([#26](https://github.com/CQCL/hugr-llvm/pull/26)) | ||
- Add initial codegen extension for `prelude` ([#29](https://github.com/CQCL/hugr-llvm/pull/29)) | ||
- [**breaking**] `Namer` optionally appends node index to mangled names. ([#32](https://github.com/CQCL/hugr-llvm/pull/32)) | ||
- Implement lowerings for ieq,ilt_s,sub in int codegen extension ([#33](https://github.com/CQCL/hugr-llvm/pull/33)) | ||
- Add initial `float` extension ([#31](https://github.com/CQCL/hugr-llvm/pull/31)) | ||
- Emit more int comparison operators ([#47](https://github.com/CQCL/hugr-llvm/pull/47)) | ||
|
||
### Refactor | ||
- clean up fat.rs ([#38](https://github.com/CQCL/hugr-llvm/pull/38)) | ||
|
||
### Testing | ||
- add a test for sum type tags | ||
- Add integration tests lowering guppy programs ([#35](https://github.com/CQCL/hugr-llvm/pull/35)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[package] | ||
name = "hugr-llvm" | ||
version = "0.13.3" | ||
description = "A general and extensible crate for lowering HUGRs into LLVM IR" | ||
|
||
edition.workspace = true | ||
rust-version.workspace = true | ||
|
||
readme = "README.md" | ||
license.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
documentation = "https://docs.rs/hugr-llvm" | ||
authors = ["TKET development team <[email protected]>"] | ||
keywords = ["Quantum", "Quantinuum"] | ||
categories = ["compilers"] | ||
|
||
[features] | ||
default = ["llvm14-0"] | ||
llvm14-0 = ["inkwell/llvm14-0"] | ||
|
||
[dependencies] | ||
inkwell = { version = "0.4.0", default-features = false } | ||
hugr-core = { path = "../hugr-core", version = "0.13.3"} | ||
anyhow = "1.0.83" | ||
itertools.workspace = true | ||
delegate.workspace = true | ||
petgraph.workspace = true | ||
lazy_static.workspace = true | ||
downcast-rs.workspace = true | ||
strum.workspace = true | ||
|
||
[dev-dependencies] | ||
insta.workspace = true | ||
rstest.workspace = true | ||
portgraph.workspace = true | ||
pathsearch.workspace = true | ||
serde_json.workspace = true | ||
serde.workspace = true | ||
typetag.workspace = true |
Oops, something went wrong.