fix!: Passes with Nested Modifier#1546
Open
nicolaassolini-qntm wants to merge 45 commits intomainfrom
Open
Conversation
…ance result handling
…nhance testing pipeline
…ple script for modifier testing
… double_modifier.py, update rendering, and improve apply_passes.py logic
…and update justfile for hugr compilation
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1546 +/- ##
==========================================
+ Coverage 83.80% 84.03% +0.22%
==========================================
Files 188 188
Lines 29035 29097 +62
Branches 27931 27993 +62
==========================================
+ Hits 24333 24451 +118
+ Misses 3540 3473 -67
- Partials 1162 1173 +11
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:
|
Collaborator
|
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary |
…_saved_hugr Co-authored-by: Copilot <copilot@github.com>
…for processing hugrs Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…rs for validation and fix doc indentation Co-authored-by: Copilot <copilot@github.com>
…structs to private Co-authored-by: Copilot <copilot@github.com>
…_modifier_with_entrypoints function
…nd related scripts
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.
closes #1518 closes #1520
Bug 1
The condition in
modify_fn_if_neededwas incorrect. As a result, the pass solver attempted to process classical functions, leading to an invalid inversion of non-quantum input ordering.Bug 2
There was a misalignment between metadata-derived values (
from_metadata) and the corresponding function representation. This inconsistency became visible with nested modifiers, where metadata mismatches caused the modifier builder to skip the modified block, ultimately triggering errors.Bug 3
In modify_cfg, wire_node_inout was called with the modified signature types. The modified signature has extra control qubits prepended. Since wire_node_inout iterates the type list while incrementing old port indices starting from 0, it was misaligned producing two Out ports that can't be connected.
Fix:
modify_fn_if_neededhas been corrected to properly exclude classical functions.modifier_resolver.rs#L1069we use the original signature instead of the modified one since the offset already contains the information about the added qubits.Additional tests have been introduced to improve coverage of modifier handling and HUGR construction.
[test_pass](https://github.com/Quantinuum/tket2/blob/52d10e19a91f46825c3eaf38f7c65e5f5a80bf81/tket-py/test/test_pass.py#L254)test has been extended: it now validates not only execution but also correct resolution of modifiers, increasing confidence in the end-to-end behavior.BREAKING CHANGE: In
ModifierResolver::modify_fn_if_neededthe parametersignaturehas been removedBREAKING CHANGE: In
control.rs,dagger.rs, andpower.rs, the modifier constructorsnew()became private, andsignature()was reduced frompubtopub(crate).BREAKING CHANGE: In
modifier_resolver.rs, several internal helpers were hidden or narrowed:BREAKING CHANGE:
DirWire::new,ModifierResolver::new,ModifierResolverErrors::{unreachable, unresolvable},connect_all, andmodify_signatureare now private.BREAKING CHANGE:
DirWire::reverseis nowpub(crate)BREAKING CHANGE: In resolver submodules:
modify_fn_if_needed,modify_fn,modify_global_phase,delete_phase, andmodify_tket_opwere changed frompubtopub(crate).