feat: NormalizeGuppy uses inline_acyclic, fixes 2*opt tests#1270
Open
feat: NormalizeGuppy uses inline_acyclic, fixes 2*opt tests#1270
Conversation
acl-cqc
commented
Nov 18, 2025
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:
|
acl-cqc
commented
Nov 26, 2025
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"] |
Contributor
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.