-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add check for the size
during transpiler optimization
#7542
Conversation
Pull Request Test Coverage Report for Build 2007200649
💛 - Coveralls |
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.
Is there a reason to limit this to level 2? The same iteration happens in levels 1 and 3 as well.
The tests of the preset pass managers are in test/python/transpiler/test_preset_passmanagers.py
, but this would be fairly tricky to write a targetted test for, I think. In principle, we could construct one by making a circuit with two disjoint sets of qubits, where the first set has an operation that cancels down to a size of 0, but only after 3 loops, while the second collapses down in only 1 loop to a depth of more than first set has after the first loop. Finding those operations would be tricky, though; it would be easy for unrelated improvements in other transpiler passes to stymie the test by immediately reducing both paths to their smallest size.
At the very least, we could add a regression test of the case in #7386 to ensure that two subsequent calls to transpile
don't change the size or depth.
@jakelishman would this PR require any more changes? I had updated the issue with some benchmarks which caught my eye. |
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.
Thanks for the updates here @TheGupta2012 , this LGTM!
Summary
Add check for the
size
during transpiler optimization fixing #7386Details and comments
qiskit/transpiler/preset_passmanagers/level2.py
, a size check loop is introduced.PassManager
which are iterated till the size is not constant across consecutive iterations.Code for Results
Resultant Output