-
Notifications
You must be signed in to change notification settings - Fork 14
feat!: ReplaceTypes: allow lowering ops into a Call to a function already in the Hugr #2094
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-rs-v0.16.0 #2094 +/- ##
======================================================
+ Coverage 83.29% 83.30% +0.01%
======================================================
Files 219 218 -1
Lines 42051 42102 +51
Branches 38153 38307 +154
======================================================
+ Hits 35026 35073 +47
+ Misses 5220 5218 -2
- Partials 1805 1811 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary
|
|
Ok, so NodeTemplate::add_hugr already returned an error, but NodeTemplate::add needed one. And, the errors from both needed to be plumbed through ReplaceTypesError and LinearizeError. I started trying to add my own error for |
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.
happy to see many unwraps go away
hugr-passes/src/replace_types.rs
Outdated
// TODO allow also Call to a Node in the existing Hugr | ||
// (can't see any other way to achieve multiple calls to the same decl. | ||
// So client should add the functions before replacement, then remove unused ones afterwards.) | ||
/// A Call to a function (already) existing in the 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.
/// A Call to a function (already) existing in the Hugr. | |
/// A Call to an existing function. |
…eady in the Hugr (#2094) There are two issues: * Errors. The previous NodeTemplates still always work, but the Call one can fail if the Hugr doesn't contain the target function node. ATM there is no channel for reporting that error so I've had to panic. Otherwise it's an even-more-breaking change to add an error type to `NodeTemplate::add()` and `NodeTemplate::add_hugr()`. Should we? (I note `HugrMut::connect` panics if the node isn't there, but could make the `NodeTemplate::add` builder method return a BuildError...and propagate that everywhere of course) * There's a big limitation in `linearize_array` that it'll break if the *element* says it should be copied/discarded via a NodeTemplate::Call, as `linearize_array` puts the elementwise copy/discard function into a *nested Hugr* (`Value::Function`) that won't contain the function. This could be fixed via lifting those to toplevel FuncDefns with name-mangling, but I'd rather leave that for #2086 .... BREAKING CHANGE: Add new variant NodeTemplate::Call; LinearizeError no longer derives Eq.
There are two issues:
NodeTemplate::add()
andNodeTemplate::add_hugr()
. Should we? (I noteHugrMut::connect
panics if the node isn't there, but could make theNodeTemplate::add
builder method return a BuildError...and propagate that everywhere of course)linearize_array
that it'll break if the element says it should be copied/discarded via a NodeTemplate::Call, aslinearize_array
puts the elementwise copy/discard function into a nested Hugr (Value::Function
) that won't contain the function. This could be fixed via lifting those to toplevel FuncDefns with name-mangling, but I'd rather leave that for Reduce duplication when linearizing arrays #2086 ....BREAKING CHANGE: Add new variant NodeTemplate::Call; LinearizeError no longer derives Eq.