qiskit
qiskit copied to clipboard
[WIP] Refactor template matching
Summary
Refactor the template matching transpiler pass achieving 4x speedup.
Details and comments
This PR refactors the template matching transpiler pass to incorporate the changes to DAGDependencyV2
and to inject a number of other efficiencies. This results in a 4x speedup with significantly reduced memory usage for large circuits.
The PR incorporates the code from #12194 which requires rustworkx
0.15.0 to be released, so this should still be considered development code at this point.
In spite of the speedup, the template matching algorithm which guarantees an optimal match is quadratic in the number of gates. I was able to run local tests on 3000 gates in about 2 min., but 10,000 gates would take 20 min or so. There are heuristics supplied in the original code, but these did not show significant improvement with the random clifford circuits I tested with.
There could be another round of optimizations to the code to try to develop better heuristics that would produce correct, but sometimes not optimal matches.
One or more of the the following people are requested to review this:
-
@Qiskit/terra-core