Skip to content

Conversation

@acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Nov 18, 2025

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 - nested and ranges now pass if we start from the .flat hugr. (Of course we don't expect normal to be flattened into .flat yet.)

Angles crashes with #1297.

The first commit shows the benefit of just adding NormalizeGuppyPass to optimize_guppy_pytket (should probably be renamed to optimize_guppy_flat), i.e., minimal without the inlining.

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.88%. Comparing base (133c885) to head (79207a5).

Files with missing lines Patch % Lines
tket/src/passes/guppy.rs 91.66% 0 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
python 92.92% <ø> (ø)
qis-compiler 100.00% <ø> (ø)
rust 79.22% <91.66%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#[case::angles("angles", Some(vec![
("tket.quantum.Rz", 2), ("tket.quantum.MeasureFree", 1), ("tket.quantum.H", 2), ("tket.quantum.QAlloc", 1)
]))]
#[should_panic = "UnsupportedSubgraphHasNoRegisters"]
Copy link
Contributor Author

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

@acl-cqc acl-cqc marked this pull request as ready for review November 26, 2025 16:34
@acl-cqc acl-cqc requested a review from a team as a code owner November 26, 2025 16:34
@acl-cqc acl-cqc requested a review from aborgna-q November 26, 2025 16:34
Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

I guess an alternative would be to look at the call graph, and optimize all reachable functions? (That should probably be an option in the passes)

Try rebasing on #1295 & #1298 to see how the errors change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants