-
Notifications
You must be signed in to change notification settings - Fork 6
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(hugr-passes): op replacement and lowering functions #1509
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1509 +/- ##
==========================================
+ Coverage 87.26% 87.27% +0.01%
==========================================
Files 127 128 +1
Lines 21661 21717 +56
Branches 18662 18718 +56
==========================================
+ Hits 18902 18954 +52
- Misses 1989 1990 +1
- Partials 770 773 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, I do think signature of lower_ops
should be improved.
replacements | ||
.into_iter() | ||
.map(|(node, replacement)| { | ||
let subcirc = SiblingSubgraph::try_from_nodes([node], hugr)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a common pattern, it would be nice to write
let subcirc = SiblingSubgraph::try_from_nodes([node], hugr)?; | |
let subcirc = SiblingSubgraph::from_node(node, hugr); |
Do feel free to punt on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offer simple interfaces for bulk lowering operations. `replace_ops` provided on top of lowering as replacing individual ops is much more efficient than splicing in subgraphs.
## 🤖 New release * `hugr`: 0.12.0 -> 0.12.1 * `hugr-core`: 0.9.0 -> 0.9.1 * `hugr-passes`: 0.8.0 -> 0.8.1 * `hugr-cli`: 0.5.0 -> 0.6.0 <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr` <blockquote> ## 0.12.1 (2024-09-04) ### Bug Fixes - `std.collections.insert` wrong output order ([#1513](#1513)) ### Features - Op replacement and lowering functions ([#1509](#1509)) </blockquote> ## `hugr-core` <blockquote> ## 0.9.1 (2024-09-04) ### Bug Fixes - `std.collections.insert` wrong output order ([#1513](#1513)) </blockquote> ## `hugr-passes` <blockquote> ## 0.8.1 (2024-09-04) ### Features - Op replacement and lowering functions ([#1509](#1509)) </blockquote> ## `hugr-cli` <blockquote> ## 0.6.0 (2024-09-04) ### Features - [**breaking**] Allow registry specification in `run_dump` ([#1501](#1501)) - [**breaking**] Add `Package::validate` and return `ExtensionRegistry` in helpers. ([#1507](#1507)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/).
## 🤖 New release * `hugr`: 0.12.1 -> 0.13.0 (✓ API compatible changes) * `hugr-core`: 0.9.1 -> 0.10.0 (✓ API compatible changes) * `hugr-passes`: 0.8.1 -> 0.8.2 (✓ API compatible changes) * `hugr-cli`: 0.6.0 -> 0.6.1 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr` <blockquote> ## 0.13.0 (2024-10-08) ### Bug Fixes - [**breaking**] Make list length op give back the list ([#1547](#1547)) ### Features - [**breaking**] Allow CustomConsts to (optionally) be hashable ([#1397](#1397)) - Add an `OpLoadError` variant of `BuildError`. ([#1537](#1537)) - [**breaking**] `HugrMut::remove_node` and `SimpleReplacement` return removed weights ([#1516](#1516)) - Draft for `hugr-model` with export, import, parsing and pretty printing ([#1542](#1542)) </blockquote> ## `hugr-core` <blockquote> ## 0.10.0 (2024-10-08) ### Bug Fixes - [**breaking**] Make list length op give back the list ([#1547](#1547)) ### Features - [**breaking**] Allow CustomConsts to (optionally) be hashable ([#1397](#1397)) - Add an `OpLoadError` variant of `BuildError`. ([#1537](#1537)) - [**breaking**] `HugrMut::remove_node` and `SimpleReplacement` return removed weights ([#1516](#1516)) - Draft for `hugr-model` with export, import, parsing and pretty printing ([#1542](#1542)) </blockquote> ## `hugr-passes` <blockquote> ## 0.8.1 (2024-09-04) ### Features - Op replacement and lowering functions ([#1509](#1509)) </blockquote> ## `hugr-cli` <blockquote> ## 0.6.0 (2024-09-04) ### Features - [**breaking**] Allow registry specification in `run_dump` ([#1501](#1501)) - [**breaking**] Add `Package::validate` and return `ExtensionRegistry` in helpers. ([#1507](#1507)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/).
Offer simple interfaces for bulk lowering operations.
replace_ops
provided on top of lowering as replacing individual ops is much more efficient than splicing in subgraphs.