-
Notifications
You must be signed in to change notification settings - Fork 7
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: Add CircuitDiff #773
base: main
Are you sure you want to change the base?
Conversation
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #773 +/- ##
==========================================
+ Coverage 82.46% 82.69% +0.23%
==========================================
Files 65 67 +2
Lines 7979 8386 +407
Branches 7717 8124 +407
==========================================
+ Hits 6580 6935 +355
- Misses 1002 1024 +22
- Partials 397 427 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I've double checked, there are no breaking changes once commit f109186 is reverted. But it will require hugr#1920 to be merged, along with a hugr release. |
e4685d1
to
6bf8e4d
Compare
Fyi the |
I'm introducing
CircuitDiff
s, for persistent graph rewriting! Once done, this will speed up badger-like workflows significantly (see below).CircuitDiff
s, which could be renamed toCircuitPatch
es if you prefer, store a subgraph for each of their parent diffs, along with the new replacement graph to rewrite the subgraphs to. Currently, diffs with no parents are created from a circuit, whilst other diffs are created by applying aSimpleReplacement
onto a parent diff. This means that right now, only diffs with a single parent can be constructed (see below)How speedup?
Given rewrites A, B and C with disjoint support, instead of having to consider individual graphs with respectively rewrites A, B, C, AB, BC, AC and ABC applied, the three rewrites can be applied independently and there will only be
CircuitDiff
for A, B and C. At pattern matching time, the matcher will have to consider the various combinations that are possible, but only within the local region that matches overlap with.What's next
CircuitHistory
: a set of diffs that are compatible with each other (i.e. there are no conflicting rewrites). Then rewrites can be applied to histories, which will create diffs with multiple parents. I will try to implementHugrView
on these