-
Notifications
You must be signed in to change notification settings - Fork 11
feat: NormalizeGuppy uses inline_acyclic, fixes 2*opt tests #1270
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1270 +/- ##
==========================================
+ Coverage 79.60% 79.88% +0.28%
==========================================
Files 160 160
Lines 20601 20610 +9
Branches 19635 19644 +9
==========================================
+ Hits 16399 16464 +65
+ Misses 3221 3167 -54
+ Partials 981 979 -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:
|
tket-qsystem/tests/guppy_opt.rs
Outdated
| #[case::angles("angles", Some(vec![ | ||
| ("tket.quantum.Rz", 2), ("tket.quantum.MeasureFree", 1), ("tket.quantum.H", 2), ("tket.quantum.QAlloc", 1) | ||
| ]))] | ||
| #[should_panic = "UnsupportedSubgraphHasNoRegisters"] |
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.
I'm gonna investigate this as a distinct bug, I have the hugr for which run_pytket fails, expect to link to an issue here
aborgna-q
left a comment
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.
One reason that the guppy-optimization tests are doing so badly is we are typically only doing NormalizeGuppy stuff beneath the entrypoint, which is the main function. In most tests main just allocates some qubits, calls some “circuit” function outside the entrypoint, then measures and results. IIUC, EncodedCircuit might “inline” the call to the circuit (but even that is currently disabled, IIUC), and that won’t have been NormalizeGuppy'd...
Anyway, inlining everything into the entrypoint should bring all the code we need into range of NormalizeGuppy, and lo -
nestedandrangesnow pass if we start from the.flathugr. (Of course we don't expect normal to be flattened into.flatyet.)Angles crashes with #1297.
The first commit shows the benefit of just adding NormalizeGuppyPass to
optimize_guppy_pytket(should probably be renamed tooptimize_guppy_flat), i.e., minimal without the inlining.