Skip to content
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

[WIP] Refactor template matching #12351

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

enavarro51
Copy link
Contributor

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.

@enavarro51 enavarro51 requested a review from a team as a code owner May 6, 2024 14:56
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@jakelishman jakelishman self-assigned this May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants