-
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
The number of CZ gates after transpilation (optimization level=2 and 3) increases drastically for 1.3.0rc1 and main branch compared with 1.2.4 #13459
Comments
Thanks, this is pointing to another in the oxidized consolidate blocks. The lack of collect2qblocks is expected because that's now run inline consolidate blocks all in rust for efficiency. But the fact that it's only collecting 4 unitaries when in 1.2.4 it returned 72 is an issue. |
The issue here is a difference between how Rust's two qubit decomposer interface works and the python api that wraps it. In rust we call |
The ConsolidateBlocks pass was ported to rust in Qiskit#13368 and as part of that implementation a small behavior difference between the rust and python interfaces was causing the pass to not work correctly with non-CX gates. The internal 2q decomposer interface stores a sentinel string for the kak gate which is used to tell the python space constructor use the python defined gate object. However in the pass code we weren't factoring this difference in, and for non-CX gates we were evaluating the basis count as the number of gates with that sentinel value name (which is almost always zero) and this was preventing the pass from consolidating many blocks that should have been. This commit fixes this issue by taking the name from python space and passing it through to the rust portion of the code and using that for the comparison. Fixes Qiskit#13459
The ConsolidateBlocks pass was ported to rust in #13368 and as part of that implementation a small behavior difference between the rust and python interfaces was causing the pass to not work correctly with non-CX gates. The internal 2q decomposer interface stores a sentinel string for the kak gate which is used to tell the python space constructor use the python defined gate object. However in the pass code we weren't factoring this difference in, and for non-CX gates we were evaluating the basis count as the number of gates with that sentinel value name (which is almost always zero) and this was preventing the pass from consolidating many blocks that should have been. This commit fixes this issue by taking the name from python space and passing it through to the rust portion of the code and using that for the comparison. Fixes #13459
The ConsolidateBlocks pass was ported to rust in #13368 and as part of that implementation a small behavior difference between the rust and python interfaces was causing the pass to not work correctly with non-CX gates. The internal 2q decomposer interface stores a sentinel string for the kak gate which is used to tell the python space constructor use the python defined gate object. However in the pass code we weren't factoring this difference in, and for non-CX gates we were evaluating the basis count as the number of gates with that sentinel value name (which is almost always zero) and this was preventing the pass from consolidating many blocks that should have been. This commit fixes this issue by taking the name from python space and passing it through to the rust portion of the code and using that for the comparison. Fixes #13459 (cherry picked from commit c792426)
The ConsolidateBlocks pass was ported to rust in #13368 and as part of that implementation a small behavior difference between the rust and python interfaces was causing the pass to not work correctly with non-CX gates. The internal 2q decomposer interface stores a sentinel string for the kak gate which is used to tell the python space constructor use the python defined gate object. However in the pass code we weren't factoring this difference in, and for non-CX gates we were evaluating the basis count as the number of gates with that sentinel value name (which is almost always zero) and this was preventing the pass from consolidating many blocks that should have been. This commit fixes this issue by taking the name from python space and passing it through to the rust portion of the code and using that for the comparison. Fixes #13459 (cherry picked from commit c792426) Co-authored-by: Matthew Treinish <[email protected]>
Thank you for fixing the issue. I confirmed that it is resolved by 1.3.0rc2.
|
Environment
What is happening?
The number of CZ gates after transpilation with optimization_level 2 and 3 increases drastically for 1.3.0rc1 and main branch compared with 1.2.4
How can we reproduce the issue?
I attach a zip file with
qaoa.qpy
that includes the target circuit generated from QAOA.I tried to make a minimal example, but I could not do it unfortunately.
Need to unzip the attachment file qaoa.zip to extract
qaoa.qpy
.What should happen?
The number of CZ gates should be as same as that of 1.2.4.
Any suggestions?
I tried callback to check the count ops for each pass and found that something is happening around
ConsolidateBlocks
.Collect2qBlocks
seems to disappear for the main branch.full log is available at https://gist.github.com/t-imamichi/eb35f536117e45dd89293e7e979132cb
The text was updated successfully, but these errors were encountered: