Add CommutativeOptimization to transpiler pipeline#15464
Add CommutativeOptimization to transpiler pipeline#15464alexanderivrii wants to merge 11 commits intoQiskit:mainfrom
CommutativeOptimization to transpiler pipeline#15464Conversation
…lt transpiler pipeline for continuous basis sets
|
One or more of the following people are relevant to this code:
|
CommutativeOptimization to transpiler pipeline
Pull Request Test Coverage Report for Build 21632577862Details
💛 - Coveralls |
|
I have slightly changed the order of the passes in the default optimization pass manager for The previous order when
There was one example where this got stuck in an infinite loop with the basis set
With the new order, optimize1q brings the circuit to the desired basis, the optional basis translator is no longer needed, and no "wobbling" happens. Regardless of the problematic example above, I believe that applying CommutativeOptimization before Optimize1q also makes sense in general. |
|
I have rebased this pass on top of main and locally run the full suite of ASV benchmarks. Regarding performance. Except for the benchmarks mentioned previously in this comment, there was nothing else statistically significant. Regarding quality of the output circuit. There are actually two family of benchmarks where the depth has increased:
In both cases the change is due not to interchanging the order of QFT:
QUEKO:
There is no statistical difference on these benchmarks. |
|
If the benchmarks are running without a fixed seed than this kind of variability is to be expected. We should fix the benchmarks to use a fixed seed. Although that will have the unfortunate consequence of invalidating the historical results since we change the benchmark's code and the sha1 of the code is the default version. I would be more curious about a larger more diverse benchmark set for output quality. Benchpress is what comes to mind, but you'll have the same random noise in the quality benchmarks because benchpress doesn't fix a seed. You could modify the benchpress benchmarks to set a transpiler seed and then use that to compare. |
|
I was just looking at this again, can you also update the C transpiler pipeline in |
| if not pass_manager_config._is_clifford_t: | ||
| # For continuous basis sets, we now CommutativeOptimization instead of | ||
| # CommutativeCancellation. For Clifford+T transpilation, we still use | ||
| # CommutativeCancellation and disable consolidating | ||
| # blocks as this involves resynthesizing 2-qubit unitaries. | ||
| if pass_manager_config._is_clifford_t: | ||
| init.append(CommutativeCancellation()) | ||
| else: | ||
| init.append(CommutativeOptimization()) | ||
| init.append(ConsolidateBlocks()) | ||
|
|
||
| # If approximation degree is None that indicates a request to approximate up to the |
There was a problem hiding this comment.
This needs rebasing on main now 🙂
| approximation_degree=pass_manager_config.approximation_degree, | ||
| target=pass_manager_config.target, | ||
| ), | ||
| CommutativeOptimization(), |
There was a problem hiding this comment.
Is CommutativeCancellation faster than Gucci? If yes we can also only run Gucci in the init stage where we expect it to provide an advantage and keep using the existing flow in lower-level stages.
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.