-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add boundary edge traversal in SimpleReplacement #2231
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 @@
## main #2231 +/- ##
==========================================
+ Coverage 82.00% 82.03% +0.03%
==========================================
Files 234 234
Lines 41619 41702 +83
Branches 37532 37616 +84
==========================================
+ Hits 34128 34209 +81
Misses 5518 5518
- Partials 1973 1975 +2
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:
|
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.
👍
#[derive(Debug, Clone, Copy)] | ||
/// This is used to represent boundary edges that will be added between the host | ||
/// and replacement graphs when applying a rewrite. | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] |
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.
Add Hash
too ? (same on HostPort
)
I believe these methods finally expose the "right" way to think of the boundary between a replacement and its subgraph, in particular this won't be broken as we extend
SiblingSubgraph
to express more types of subgraphs (see issue #2212).The idea is simple: for any replacement, there must be links between ports that are just outside the
subgraph
in host, and ports that are linked to the input and output nodes of thereplacement
. These links are precisely the edges that will need to be added when the replacement is applied, between the existing host HUGR and the newly added nodes of thereplacement
. Specifically these edges link:host
that are "just before the subgraph" (i.e. ports linked to an incoming port ofsubgraph
) to incoming ports inreplacement
that are linked to the input node, andhost
that are "just after the subgraph" (i.e. ports linked to an outgoing port ofsubgraph
) to outgoing ports inreplacement
that are linked to the output node.