Closed Cryoris closed 1 month ago
One or more of the following people are relevant to this code:
@Cryoris
@Qiskit/terra-core
@ajavadia
@kevinhartman
@mtreinish
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
qiskit/transpiler/passes/synthesis/hls_plugins.py | 25 | 27 | 92.59% | ||
crates/accelerate/src/synthesis/multi_controlled/mcmt.rs | 94 | 101 | 93.07% | ||
qiskit/circuit/library/generalized_gates/mcmt.py | 57 | 64 | 89.06% | ||
<!-- | Total: | 193 | 209 | 92.34% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
crates/qasm2/src/parse.rs | 6 | 97.61% | ||
crates/qasm2/src/lex.rs | 8 | 91.48% | ||
<!-- | Total: | 14 | --> |
Totals | |
---|---|
Change from base Build 11161049152: | 0.02% |
Covered Lines: | 74476 |
Relevant Lines: | 83782 |
thanks @Cryoris for opening this PR! It also handles issue #12863. What do you think about issue https://github.com/Qiskit/qiskit/issues/10698 ? I think it should be a small addition, but could also be handled in a follow-up PR.
Lol, the tests have failed due to cargo clippy
warnings. And I caught one of them in the review. :)
Thank you very much! As per your question, could you please add a table for documenting MCMT synthesis plugins (in hls_plugins.py
, the output should be in https://docs.quantum.ibm.com/api/qiskit/transpiler_synthesis_plugins) and the new synthesis function (the output should be in https://docs.quantum.ibm.com/api/qiskit/synthesis). Also this deserves a release note, listing new functionality and deprecations.
This has a merge conflict now that https://github.com/Qiskit/qiskit/commit/642debf8b2433aa2d814341b96fdc6803b53cbc0 has merged. The interface for CircuitData::from_packed_operations
has changed to include a result and its usage here will need to be updated.
Done in 60a82a3 👍🏻
Summary
Make the MCMT circuits a gate with pluggable synthesis method, plus port the V-chain synthesis to Rust. This is part of #13046.
Details and comments
Even though the focus of this PR is the restructuring into a block that the compiler can reason about, there's also a nice speedup due to the port to Rust:
New runtime / Old runtime = 0.63 (geo mean)
``` -- n = 50 ntarg = 1 main: 5.604e-04 +- 1.514e-04 this: 3.490e-04 +- 1.771e-04 fraction: 0.64 -- n = 50 targ = 5 main: 5.612e-04 +- 1.180e-04 this: 3.051e-04 +- 1.267e-04 fraction: 0.54 -- n = 50 targ = 25 main: 7.027e-04 +- 1.188e-04 this: 3.727e-04 +- 1.225e-04 fraction: 0.53 -- n = 200 targ = 1 main: 2.074e-03 +- 2.704e-04 this: 1.631e-03 +- 2.565e-03 fraction: 0.78 -- n = 200 targ = 20 main: 2.693e-03 +- 2.488e-03 this: 1.646e-03 +- 2.433e-03 fraction: 0.62 -- n = 200 targ = 100 main: 2.616e-03 +- 2.670e-04 this: 1.880e-03 +- 2.594e-03 fraction: 0.71 -- n = 1000 targ = 1 main: 1.087e-02 +- 4.227e-03 this: 6.820e-03 +- 5.478e-03 fraction: 0.62 -- n = 1000 targ = 100 main: 1.251e-02 +- 6.234e-03 this: 7.843e-03 +- 6.380e-03 fraction: 0.62 -- n = 1000 targ = 500 main: 1.415e-02 +- 5.152e-03 this: 9.360e-03 +- 6.755e-03 fraction: 0.66 ```