Skip to content

Conversation

@alexanderivrii
Copy link
Member

Summary

Addresses #15452.

This PR replaces CommutativeCancellation by CommutativeOptimization in the default compilation pipeline for continuous basis sets, which is relevant for optimization levels 2 and 3. This should provide higher quality results at similar runtimes.

Since this is an important change, we did not want to do it late in 2.3, but it would be nice to do it early for 2.4, so that we have a sufficient time to test the impact.

Details and Comments:

We do not want to apply this change for Clifford+T transpilation, since we need to fully rethink that pipeline, and this is tracked independently in #15457.

@alexanderivrii alexanderivrii added this to the 2.4.0 milestone Dec 18, 2025
@alexanderivrii alexanderivrii requested a review from a team as a code owner December 18, 2025 08:24
@alexanderivrii alexanderivrii added the mod: transpiler Issues and PRs related to Transpiler label Dec 18, 2025
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@alexanderivrii alexanderivrii changed the title Comm opt in transpiler pipeline Add CommutativeOptimization to transpiler pipeline Dec 18, 2025
approximation_degree=pass_manager_config.approximation_degree
),
InverseCancellation(),
ContractIdleWiresInControlFlow(),
Copy link
Contributor

Choose a reason for hiding this comment

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

After ContractIdleWiresInControlFlow does CommutativeOptimization keep gates inside their original if_test block, or can it move gates between different if_test blocks?

Example:

if_test(cr): cx(0,1); h(1) # Block 1
if_test(cr): z(1); cx(0,1) # Block 2

Can it swap h(1)↔z(1) across blocks?

init.append(CommutativeCancellation())
else:
init.append(ConsolidateBlocks())
init.append(CommutativeOptimization())
Copy link
Contributor

Choose a reason for hiding this comment

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

Just trying to understand the ConsolidateBlocksCommutativeOptimization order. Is there any logic behind? Does ConsolidateBlocks first create larger blocks specifically to give CommutativeOptimization more gates to reorder? Why this sequence vs reverse?

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

Labels

mod: transpiler Issues and PRs related to Transpiler

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

3 participants