Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Represent order edges in hugr-model as metadata. #2027

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

zrho
Copy link
Contributor

@zrho zrho commented Mar 25, 2025

This PR introduces metadata to encode order edges in hugr-model. The children of a dataflow region can be assigned a key via order_hint.key metadata. Then order_hint.order metadata on the dataflow region encodes order edges between keys. The PR includes the necessary import and export code in hugr-core.

Copy link

codecov bot commented Mar 25, 2025

Codecov Report

Attention: Patch coverage is 57.35736% with 142 lines in your changes missing coverage. Please review.

Project coverage is 82.92%. Comparing base (5dd1f96) to head (e13e8d5).

Files with missing lines Patch % Lines
hugr-model/src/capnp/hugr_v0_capnp.rs 24.39% 61 Missing and 1 partial ⚠️
hugr-core/src/import.rs 52.00% 8 Missing and 16 partials ⚠️
hugr-py/src/hugr/model/export.py 8.00% 23 Missing ⚠️
hugr-model/src/v0/ast/python.rs 0.00% 11 Missing ⚠️
hugr-py/src/hugr/envelope.py 30.00% 7 Missing ⚠️
hugr-py/src/hugr/model/__init__.py 66.66% 4 Missing ⚠️
hugr-core/src/envelope.rs 25.00% 0 Missing and 3 partials ⚠️
hugr-model/src/v0/binary/read.rs 80.00% 0 Missing and 3 partials ⚠️
hugr-core/src/package.rs 95.00% 0 Missing and 1 partial ⚠️
hugr-model/src/v0/ast/mod.rs 90.90% 0 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2027      +/-   ##
==========================================
- Coverage   83.09%   82.92%   -0.18%     
==========================================
  Files         215      215              
  Lines       40895    41167     +272     
  Branches    37109    37345     +236     
==========================================
+ Hits        33981    34137     +156     
- Misses       5030     5132     +102     
- Partials     1884     1898      +14     
Flag Coverage Δ
python 85.32% <30.00%> (-0.53%) ⬇️
rust 82.67% <62.19%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

codspeed-hq bot commented Mar 25, 2025

CodSpeed Performance Report

Merging #2027 will not alter performance

Comparing zrho/model-order-hints (e13e8d5) with main (5dd1f96)

Summary

✅ 21 untouched benchmarks

@zrho zrho force-pushed the zrho/model-order-hints branch 2 times, most recently from bca1673 to e4363b6 Compare March 26, 2025 12:21
@hugrbot
Copy link
Collaborator

hugrbot commented Mar 26, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/enum_variant_added.ron

Failed in:
variant ImportError:OrderHint in /home/runner/work/hugr/hugr/PR_BRANCH/hugr-core/src/import.rs:72

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.40.0/src/lints/function_missing.ron

Failed in:
function hugr_core::import::import_hugr, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/import.rs:83
function hugr_core::export::export_hugr, previously in file /home/runner/work/hugr/hugr/BASELINE_BRANCH/hugr-core/src/export.rs:31

@zrho zrho force-pushed the zrho/model-order-hints branch from cd1fef9 to b20c170 Compare March 26, 2025 13:06
@zrho zrho force-pushed the zrho/model-order-hints branch 4 times, most recently from 05e3953 to 9cc1bfe Compare March 26, 2025 17:02
@zrho zrho force-pushed the zrho/model-order-hints branch from 9cc1bfe to 9ea72ac Compare March 26, 2025 17:38
@zrho zrho marked this pull request as ready for review March 27, 2025 17:16
@zrho zrho requested a review from a team as a code owner March 27, 2025 17:16
@zrho zrho requested a review from jake-arkinstall March 27, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants