fix(pytket decoder): Panic on repeated registers in pytket decoded output#1445
fix(pytket decoder): Panic on repeated registers in pytket decoded output#1445
Conversation
| let mut qubits: Vec<TrackedQubit> = Vec::new(); | ||
| let mut bits: Vec<TrackedBit> = Vec::new(); |
There was a problem hiding this comment.
This is the main fix.
We populated this with the registers declared at the Hugr output.
If the output said e.g. b[0], b[0], b[1] we ignored the second entry, and ended up outputting b[0], b[1], new_allocated_bit
| node, | ||
| hugr, | ||
| // Output bits use new registers, so don't reuse any input bits. | ||
| EmitCommandOptions::new().reuse_bits(|_| vec![]), |
There was a problem hiding this comment.
Drive-by: The classical expression emitter was re-using the input bits to the node instead of using a separate output bit register.
|
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1445 +/- ##
==========================================
+ Coverage 79.65% 80.01% +0.36%
==========================================
Files 155 155
Lines 20335 20333 -2
Branches 19345 19343 -2
==========================================
+ Hits 16197 16270 +73
+ Misses 3180 3101 -79
- Partials 958 962 +4
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:
|
Fix an edge case where we extracted a hugr from a pytket circuit, and declared multiple output ports to have the same bit register.
Also cleans up a bit of the logic that handled consumed bit wires, to avoid marking them as outdated if they can still be used by other operations.