-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add CommutativeOptimization to transpiler pipeline
#15464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add CommutativeOptimization to transpiler pipeline
#15464
Conversation
…lt transpiler pipeline for continuous basis sets
|
One or more of the following people are relevant to this code:
|
CommutativeOptimization to transpiler pipeline
| approximation_degree=pass_manager_config.approximation_degree | ||
| ), | ||
| InverseCancellation(), | ||
| ContractIdleWiresInControlFlow(), |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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 ConsolidateBlocks → CommutativeOptimization 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?
Summary
Addresses #15452.
This PR replaces
CommutativeCancellationbyCommutativeOptimizationin 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.