Separate out process_runs closure in Optimize1qGatesDecomposition#16595
Merged
Conversation
This commit splits out the internal closure `process_runs` that is internally used by the Optimize1qGatesDecomposition pass to process and synthesize a 1q run found in the circuit. This is just a mechanical change that is setting the stage for fixing the deadlock reported in issue Qiskit#16591 that is being fixed by Qiskit#16592. This change was originally part of Qiskit#16592 but was split out to make the logic change made in Qiskit#16592 more clear. This is just the mechanical pre-work needed for that, however while not strictly a fix this PR will need to backported to also backport Qiskit#16592.
Collaborator
|
One or more of the following people are relevant to this code:
|
3 tasks
jakelishman
approved these changes
Jul 16, 2026
jakelishman
left a comment
Member
There was a problem hiding this comment.
I carved out the two hunks like so:
{ git cat-file blob pr/16595:crates/transpiler/src/passes/optimize_1q_gates_decomposition.rs | head -n460 | tail -n+378; } > new.txt
{ git cat-file blob pr/16595~:crates/transpiler/src/passes/optimize_1q_gates_decomposition.rs | head -n470 | tail -n+382; } > old.txtthen did diff -b old.txt new.txt and got
12c12
< match state.get_basis_set(PhysicalQubit::new(0), target, basis_gates.as_ref()) {
---
> match state.get_basis_set(PhysicalQubit::new(0), target, basis_gates) {
19c19
< match state.get_basis_set(qubit, target, basis_gates.as_ref()) {
---
> match state.get_basis_set(qubit, target, basis_gates) {
27,31c27
< state.get_euler_basis_set(
< PhysicalQubit::new(0),
< target,
< global_decomposers.as_ref(),
< )
---
> state.get_euler_basis_set(PhysicalQubit::new(0), target, global_decomposers)
34,36c30,31
< state.target_basis_per_qubit[qubit.index()].get_or_init(|| {
< state.get_euler_basis_set(qubit, target, global_decomposers.as_ref())
< })
---
> state.target_basis_per_qubit[qubit.index()]
> .get_or_init(|| state.get_euler_basis_set(qubit, target, global_decomposers))
89d83
< };which is fairly easy to see is just rustfmt changes and a reference getting outlined.
| state: &Optimize1qGatesDecompositionState, | ||
| target: Option<&Target>, | ||
| basis_gates: Option<&HashSet<String>>, | ||
| global_decomposers: Option<&Vec<String>>, |
Member
There was a problem hiding this comment.
Arguably this should be Option<&[String]> and make the corresponding bits Option::as_deref(), but I see get_euler_basis_set requires Option<&Vec<String>> for some reason, so let's leave it.
Member
Author
There was a problem hiding this comment.
Heh, that's exactly what my process was while I was writing #16592 last night. I didn't want to make a deeper change as part of this to keep it targeted for backport so I just left it as &Vec.
jakelishman
enabled auto-merge
July 16, 2026 20:06
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 16, 2026
3 tasks
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.
This commit splits out the internal closure
process_runsthat is internally used by the Optimize1qGatesDecomposition pass to process and synthesize a 1q run found in the circuit. This is just a mechanical change that is setting the stage for fixing the deadlock reported in issue #16591 that is being fixed by #16592. This change was originally part of #16592 but was split out to make the logic change made in #16592 more clear. This is just the mechanical pre-work needed for that, however while not strictly a fix this PR will need to backported to also backport #16592.AI/LLM disclosure