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

Oxidize commutation checker #12870

Merged
merged 73 commits into from
Sep 3, 2024

Conversation

sbrandhsn
Copy link
Contributor

@sbrandhsn sbrandhsn commented Jul 31, 2024

Summary

fixes #12702

Details and comments

This PR implements the commutation checker with a commutation cache and library as well as a helper function for composing unitary matrices in Rust. I left a couple of things for future work:

  • Composing unitary matrices in Rust is currently not as general as the python Operator.compose but can be generalized fairly easily when Operator is implemented in Rust, too.
  • The function signature of some of the commutation functions is pretty large - this is because qubits and clbits in DAGOpNode are a PyTuple and I wanted to get rid of Python objects as early as possible. :-) The signatures can be shortened when qubits and clbits are also in Rust space.
    Two things are changed lower in the Qiskit stack in circuit_instruction.rs and operations.rs:
  • The methods is_conditioned returns whether an instruction is conditioned on classical bits and has been added to circuit_instruction.rs
  • The to_matrix method of PyGate and PyOperation has been extended to include a call to python-side Operator(self) in case the python-side to_matrix call fails. This is a change in behavior and I can pull up that code into the commutation_checker.rs but I wanted to hear everyone's opinion here. I think that if we have all the necessary information to return a matrix, we should attempt to do that even if it comes at an increase in runtime. - removed after further discussion
    I'm fairly unfamiliar with Rust so if some of the behavior can be describe more succinctly please let me know. :-)

Speedups

We can see a speedup of up to 5x depending on the type of input circuit that should be evaluated for commutation relations. I suspect that we do not see a 10x speedup, as some may have expected, because: the heavy-lifting (matrix multiplications) is done by high-performance numpy code, the incorporated commutation caching quickly turns most commutation resolutions into a constant-time lookup the larger the circuit becomes, and the commutation library already contains most of the gates that we have in rust.

Random circuits with parameterized gates only benefit the most from the rust implementation:
rotations_circuits

Followed by random circuits with any kind of gate:
random_circuits

The speedup becomes larger for Clifford circuits on larger circuits as gate checks outweigh the contant-time lookup of clifford gates in the commutation library by far
clifford_circuits

@sbrandhsn sbrandhsn requested a review from a team as a code owner July 31, 2024 15:07
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @kevinhartman
  • @mtreinish

@Cryoris
Copy link
Contributor

Cryoris commented Jul 31, 2024

Do you already have some profilings for this? 🚀

@sbrandhsn
Copy link
Contributor Author

No :-( The part responsible for composing the commutator by using eigensum is failing for now. :-(

@sbrandhsn sbrandhsn marked this pull request as draft July 31, 2024 15:26
@1ucian0 1ucian0 added the Rust This PR or issue is related to Rust code in the repository label Aug 5, 2024
@sbrandhsn sbrandhsn marked this pull request as ready for review August 8, 2024 12:07
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @kevinhartman
  • @mtreinish

@sbrandhsn sbrandhsn changed the title [WIP] Oxidize commutation checker Oxidize commutation checker Aug 8, 2024
@sbrandhsn
Copy link
Contributor Author

Ready for review, I'm running benchmarks later. :-)

@raynelfss raynelfss self-assigned this Aug 8, 2024
This commit removes the pending deprecation decorator from the python
class definition as the Python class just internally is using the rust
implementation now. This also removes directly using the rust
implementation for the standard commutation library global as using the
python class is exactly the same now.

We can revisit if there is anything we want to deprecate and remove in
2.0 in a follow up PR. Personally, I think the cache management methods
are all we really want to remove as the cache should be an internal
implementation detail and not part of the public interface.
This commit makes the pickling of cache entries explicit. Previously it
was relying on conversion traits which hid some of the complexity but
this uses a pair of conversion functions instead.
Now that the python commutation checker and the rust commutation checker
are the same thing the ddt parameterization of the commutation checker
tests was unecessary duplication. This commit removes the ddt usage to
restore having a single run of all the tests.
@mtreinish mtreinish requested a review from raynelfss August 30, 2024 20:21
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I'm happy enough with the current state of the PR to move forward here. But since I've touched a fair amount of this code now I don't think that I should approve it anymore. I think there are probably some things we could cleanup or improve in follow ups but nothing worth blocking over in particular. Especially considering this is more of an incremental step to enable #12995.

@mtreinish
Copy link
Member

Hmm, it looks like there might be a logic bug in the new code somewhere and it's not cancelling something that it used to. I ran a quick asv run to see the speedup (which is looking pretty good) but the depth for the qft example has regressed:

Benchmarks that have improved:

| Change   | Before [8e5fab6c] <lint_incr_latest~1>   | After [71ac2fd4] <oxidize-commutation-checker>   |   Ratio | Benchmark (Parameter)                                             |
|----------|------------------------------------------|--------------------------------------------------|---------|-------------------------------------------------------------------|
| -        | 861±10ms                                 | 758±3ms                                          |    0.88 | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('cz') |
| -        | 283±2ms                                  | 246±2ms                                          |    0.87 | utility_scale.UtilityScaleBenchmarks.time_bv_100('cx')            |
| -        | 1.09±0.01s                               | 909±10ms                                         |    0.84 | utility_scale.UtilityScaleBenchmarks.time_qaoa('cx')              |
| -        | 592±10ms                                 | 488±4ms                                          |    0.82 | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('cx') |
| -        | 239±2ms                                  | 178±3ms                                          |    0.75 | passes.PassBenchmarks.time_commutation_analysis(14, 1024)         |
| -        | 345±1ms                                  | 258±3ms                                          |    0.75 | passes.PassBenchmarks.time_commutation_analysis(20, 1024)         |
| -        | 76.1±0.4ms                               | 56.4±0.7ms                                       |    0.74 | passes.PassBenchmarks.time_commutation_analysis(5, 1024)          |
| -        | 8.24±0s                                  | 5.73±0.01s                                       |    0.69 | utility_scale.UtilityScaleBenchmarks.time_qv('cz')                |
| -        | 5.33±0.01s                               | 3.21±0.02s                                       |    0.6  | utility_scale.UtilityScaleBenchmarks.time_qv('cx')                |
| -        | 20.5±0.05s                               | 8.39±0.01s                                       |    0.41 | utility_scale.UtilityScaleBenchmarks.time_qft('cz')               |
| -        | 92.7±0.7ms                               | 37.3±0.2ms                                       |    0.4  | utility_scale.UtilityScaleBenchmarks.time_bvlike('cx')            |
| -        | 92.0±0.9ms                               | 36.9±0.3ms                                       |    0.4  | utility_scale.UtilityScaleBenchmarks.time_bvlike('cz')            |
| -        | 91.9±0.7ms                               | 37.0±0.3ms                                       |    0.4  | utility_scale.UtilityScaleBenchmarks.time_bvlike('ecr')           |
| -        | 19.6±0.01s                               | 7.63±0s                                          |    0.39 | utility_scale.UtilityScaleBenchmarks.time_qft('ecr')              |

Benchmarks that have stayed the same:

| Change   | Before [8e5fab6c] <lint_incr_latest~1>   | After [71ac2fd4] <oxidize-commutation-checker>   | Ratio   | Benchmark (Parameter)                                                                                           |
|----------|------------------------------------------|--------------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------|
|          | 19.1±0.2s                                | 6.40±0.03s                                       | ~0.33   | utility_scale.UtilityScaleBenchmarks.time_qft('cx')                                                             |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('cx')                                                   |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('cz')                                                   |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('ecr')                                                  |
|          | 3.82±0.1s                                | 4.07±0.2s                                        | 1.06    | utility_scale.UtilityScaleBenchmarks.time_circSU2('cz')                                                         |
|          | 3.79±0.04s                               | 4.02±0.04s                                       | 1.06    | utility_scale.UtilityScaleBenchmarks.time_circSU2('ecr')                                                        |
|          | 4.01±0s                                  | 4.10±0.02s                                       | 1.02    | utility_scale.UtilityScaleBenchmarks.time_circSU2('cx')                                                         |
|          | 10.2±0.07ms                              | 10.4±0.02ms                                      | 1.02    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('ecr')                                                |
|          | 10.3±0.1ms                               | 10.3±0.07ms                                      | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('cx')                                                 |
|          | 110±0.8ms                                | 111±2ms                                          | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('cz')                                                  |
|          | 109±0.7ms                                | 111±2ms                                          | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('ecr')                                                 |
|          | 35.3±0.5ms                               | 35.4±0.2ms                                       | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('cx')                                    |
|          | 35.0±0.4ms                               | 35.3±0.2ms                                       | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('cz')                                    |
|          | 4.31±0.07s                               | 4.34±0.02s                                       | 1.01    | utility_scale.UtilityScaleBenchmarks.time_qv('ecr')                                                             |
|          | 186±1ms                                  | 185±0.7ms                                        | 1.00    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['rz', 'x', 'sx', 'cx', 'id'])         |
|          | 10.2±0.07ms                              | 10.3±0.09ms                                      | 1.00    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('cz')                                                 |
|          | 109±1ms                                  | 109±1ms                                          | 1.00    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('cx')                                                  |
|          | 395                                      | 395                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('cx')                                                   |
|          | 397                                      | 397                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('cz')                                                   |
|          | 397                                      | 397                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('ecr')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('cx')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('cz')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('ecr')                                                 |
|          | 1607                                     | 1607                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('cx')                                                     |
|          | 1622                                     | 1622                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('cz')                                                     |
|          | 1622                                     | 1622                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('ecr')                                                    |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('cx')                                                       |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('cz')                                                       |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('ecr')                                                      |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('cx')                                        |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('cz')                                        |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('ecr')                                       |
|          | 548±0.8ms                                | 540±0.7ms                                        | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['u', 'cx', 'id'])                    |
|          | 905±7ms                                  | 897±3ms                                          | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id']) |
|          | 946±3ms                                  | 935±5ms                                          | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['rz', 'x', 'sx', 'cx', 'id'])        |
|          | 894±2ms                                  | 883±4ms                                          | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['u', 'cx', 'id'])                    |
|          | 173±1ms                                  | 172±0.2ms                                        | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id'])  |
|          | 168±0.6ms                                | 166±0.5ms                                        | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['u', 'cx', 'id'])                     |
|          | 35.9±0.2ms                               | 35.5±0.4ms                                       | 0.99    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('ecr')                                   |
|          | 1.50±0.01s                               | 1.49±0.01s                                       | 0.99    | utility_scale.UtilityScaleBenchmarks.time_qaoa('ecr')                                                           |
|          | 592±6ms                                  | 580±2ms                                          | 0.98    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['rz', 'x', 'sx', 'cx', 'id'])        |
|          | 562±3ms                                  | 547±1ms                                          | 0.97    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id']) |
|          | 260±3ms                                  | 250±2ms                                          | 0.96    | utility_scale.UtilityScaleBenchmarks.time_bv_100('ecr')                                                         |
|          | 280±0.7ms                                | 258±3ms                                          | 0.92    | utility_scale.UtilityScaleBenchmarks.time_bv_100('cz')                                                          |
|          | 1.99±0.01s                               | 1.84±0s                                          | 0.92    | utility_scale.UtilityScaleBenchmarks.time_qaoa('cz')                                                            |
|          | 702±10ms                                 | 649±2ms                                          | 0.92    | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('ecr')                                              |

Benchmarks that have got worse:

| Change   |   Before [8e5fab6c] <lint_incr_latest~1> |   After [71ac2fd4] <oxidize-commutation-checker> |   Ratio | Benchmark (Parameter)                                       |
|----------|------------------------------------------|--------------------------------------------------|---------|-------------------------------------------------------------|
| +        |                                     1954 |                                             2312 |    1.18 | utility_scale.UtilityScaleBenchmarks.track_qft_depth('cx')  |
| +        |                                     1954 |                                             2312 |    1.18 | utility_scale.UtilityScaleBenchmarks.track_qft_depth('cz')  |
| +        |                                     1954 |                                             2312 |    1.18 | utility_scale.UtilityScaleBenchmarks.track_qft_depth('ecr') |

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE DECREASED.

Copy link
Contributor

@raynelfss raynelfss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this @Cryoris, I just have a couple of inline comments, mostly just speaking about a lot of precedures that could panic! and could be handled with a Result or PyResult return value. Some of these already return PyResult so it wouldn't be too hard to just make those work and return Python error types.

The reason why we should prefer PyResults over panic! for python exposed API, is that Python cannot serialize PanicException instances, thus these are taken with more severity and can't be handled properly. Now, this is only for python exposed API, for rust based api's it should be fine as long as the panic! is produced due to a programming error in rust and not necessarily something coming from Python.

@Cryoris
Copy link
Contributor

Cryoris commented Sep 2, 2024

but the depth for the qft example has regressed

That could maybe point to different handling of gates with minuscule rotation angles -- maybe the old code considered things as commuting that the new one does not. We can check by looking at gates with tiny angles on both branches...

Edit: Yes that indeed differs. For example: CX-RZ(1e-7) commutes on main but doesn't here, since we set the commutation threshold to 1e-8. The Operator class, which was used before to check whether the products AB=BA are the same, used also an absolute tolerance of 1e-8, but additionally a relative tolerance of 1e-5 which we're currently missing here.

Cryoris and others added 2 commits September 2, 2024 12:02
Co-authored-by: Raynel Sanchez <raynelfss@hotmail.com>
@Cryoris
Copy link
Contributor

Cryoris commented Sep 2, 2024

9235004 adds backward compatible handling of the tolerances, and some further error propagation instead of eager unwrapping (in spirit of @raynelfss previous comments). If CI passes, I think it should be good to go 🙂

such as the relative placement and the parameter hash
@sbrandhsn sbrandhsn mentioned this pull request Sep 3, 2024
6 tasks
@mtreinish
Copy link
Member

I reran asv after @Cryoris's recent changes and the performance is looking quite good:

Benchmarks that have improved:

| Change   | Before [8e5fab6c] <lint_incr_latest~1>   | After [c7dde731] <oxidize-commutation-checker>   |   Ratio | Benchmark (Parameter)                                             |
|----------|------------------------------------------|--------------------------------------------------|---------|-------------------------------------------------------------------|
| -        | 278±1ms                                  | 253±3ms                                          |    0.91 | utility_scale.UtilityScaleBenchmarks.time_bv_100('cz')            |
| -        | 280±2ms                                  | 244±1ms                                          |    0.87 | utility_scale.UtilityScaleBenchmarks.time_bv_100('cx')            |
| -        | 1.07±0s                                  | 904±3ms                                          |    0.85 | utility_scale.UtilityScaleBenchmarks.time_qaoa('cx')              |
| -        | 575±5ms                                  | 491±1ms                                          |    0.85 | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('cx') |
| -        | 233±2ms                                  | 175±2ms                                          |    0.75 | passes.PassBenchmarks.time_commutation_analysis(14, 1024)         |
| -        | 338±3ms                                  | 255±2ms                                          |    0.75 | passes.PassBenchmarks.time_commutation_analysis(20, 1024)         |
| -        | 77.1±2ms                                 | 55.8±0.5ms                                       |    0.72 | passes.PassBenchmarks.time_commutation_analysis(5, 1024)          |
| -        | 5.26±0s                                  | 3.24±0s                                          |    0.62 | utility_scale.UtilityScaleBenchmarks.time_qv('cx')                |
| -        | 93.8±0.8ms                               | 37.5±0.2ms                                       |    0.4  | utility_scale.UtilityScaleBenchmarks.time_bvlike('cz')            |
| -        | 93.1±1ms                                 | 37.3±0.2ms                                       |    0.4  | utility_scale.UtilityScaleBenchmarks.time_bvlike('ecr')           |
| -        | 94.2±0.4ms                               | 37.0±0.2ms                                       |    0.39 | utility_scale.UtilityScaleBenchmarks.time_bvlike('cx')            |
| -        | 20.6±0.02s                               | 8.02±0.02s                                       |    0.39 | utility_scale.UtilityScaleBenchmarks.time_qft('cz')               |
| -        | 19.7±0.1s                                | 7.54±0s                                          |    0.38 | utility_scale.UtilityScaleBenchmarks.time_qft('ecr')              |
| -        | 19.2±0.04s                               | 6.76±0.01s                                       |    0.35 | utility_scale.UtilityScaleBenchmarks.time_qft('cx')               |

Benchmarks that have stayed the same:

| Change   | Before [8e5fab6c] <lint_incr_latest~1>   | After [c7dde731] <oxidize-commutation-checker>   | Ratio   | Benchmark (Parameter)                                                                                           |
|----------|------------------------------------------|--------------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------|
|          | 8.00±0.02s                               | 5.68±0.02s                                       | ~0.71   | utility_scale.UtilityScaleBenchmarks.time_qv('cz')                                                              |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('cx')                                                   |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('cz')                                                   |
|          | 0                                        | 0                                                | n/a     | utility_scale.UtilityScaleBenchmarks.track_bvlike_depth('ecr')                                                  |
|          | 3.69±0.01s                               | 3.85±0.2s                                        | 1.04    | utility_scale.UtilityScaleBenchmarks.time_circSU2('cx')                                                         |
|          | 105±0.4ms                                | 108±1ms                                          | 1.03    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_qv_14_x_14(2)                                        |
|          | 543±3ms                                  | 553±2ms                                          | 1.02    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['u', 'cx', 'id'])                    |
|          | 942±5ms                                  | 960±3ms                                          | 1.02    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['rz', 'x', 'sx', 'cx', 'id'])        |
|          | 4.18±0.01s                               | 4.25±0.01s                                       | 1.02    | utility_scale.UtilityScaleBenchmarks.time_qv('ecr')                                                             |
|          | 559±3ms                                  | 565±2ms                                          | 1.01    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id']) |
|          | 903±6ms                                  | 916±7ms                                          | 1.01    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id']) |
|          | 134±0.9ms                                | 135±2ms                                          | 1.01    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_qv_14_x_14(3)                                        |
|          | 35.2±0.6ms                               | 35.4±0.4ms                                       | 1.01    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('cz')                                    |
|          | 591±4ms                                  | 591±4ms                                          | 1.00    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(14, 1024, ['rz', 'x', 'sx', 'cx', 'id'])        |
|          | 893±5ms                                  | 893±6ms                                          | 1.00    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(20, 1024, ['u', 'cx', 'id'])                    |
|          | 175±0.8ms                                | 175±0.4ms                                        | 1.00    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['rx', 'ry', 'rz', 'r', 'rxx', 'id'])  |
|          | 169±1ms                                  | 169±0.7ms                                        | 1.00    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['u', 'cx', 'id'])                     |
|          | 273±1ms                                  | 274±5ms                                          | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.time_quantum_volume_transpile_50_x_20(1)                            |
|          | 82.0±0.7ms                               | 81.9±1ms                                         | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.time_schedule_qv_14_x_14(1)                                         |
|          | 103±1ms                                  | 103±0.2ms                                        | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm_backend_with_prop(1)                 |
|          | 49.0±0.09ms                              | 48.9±0.2ms                                       | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_qv_14_x_14(0)                                        |
|          | 59.3±0.2ms                               | 59.0±0.1ms                                       | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_qv_14_x_14(1)                                        |
|          | 1404                                     | 1404                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_quantum_volume_transpile_50_x_20(0)                     |
|          | 1403                                     | 1403                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_quantum_volume_transpile_50_x_20(1)                     |
|          | 1323                                     | 1323                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_quantum_volume_transpile_50_x_20(2)                     |
|          | 1296                                     | 1296                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_quantum_volume_transpile_50_x_20(3)                     |
|          | 2705                                     | 2705                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm(0)                            |
|          | 2005                                     | 2005                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm(1)                            |
|          | 7                                        | 7                                                | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm(2)                            |
|          | 7                                        | 7                                                | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm(3)                            |
|          | 2705                                     | 2705                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm_backend_with_prop(0)          |
|          | 2005                                     | 2005                                             | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm_backend_with_prop(1)          |
|          | 7                                        | 7                                                | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm_backend_with_prop(2)          |
|          | 7                                        | 7                                                | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_from_large_qasm_backend_with_prop(3)          |
|          | 465                                      | 465                                              | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_qv_14_x_14(0)                                 |
|          | 336                                      | 336                                              | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_qv_14_x_14(1)                                 |
|          | 327                                      | 327                                              | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_qv_14_x_14(2)                                 |
|          | 272                                      | 272                                              | 1.00    | transpiler_levels.TranspilerLevelBenchmarks.track_depth_transpile_qv_14_x_14(3)                                 |
|          | 10.2±0.1ms                               | 10.1±0.05ms                                      | 1.00    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('cx')                                                 |
|          | 395                                      | 395                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('cx')                                                   |
|          | 397                                      | 397                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('cz')                                                   |
|          | 397                                      | 397                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_bv_100_depth('ecr')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('cx')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('cz')                                                  |
|          | 300                                      | 300                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_circSU2_depth('ecr')                                                 |
|          | 1607                                     | 1607                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('cx')                                                     |
|          | 1622                                     | 1622                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('cz')                                                     |
|          | 1622                                     | 1622                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qaoa_depth('ecr')                                                    |
|          | 1954                                     | 1954                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qft_depth('cx')                                                      |
|          | 1954                                     | 1954                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qft_depth('cz')                                                      |
|          | 1954                                     | 1954                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qft_depth('ecr')                                                     |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('cx')                                                       |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('cz')                                                       |
|          | 2709                                     | 2709                                             | 1.00    | utility_scale.UtilityScaleBenchmarks.track_qv_depth('ecr')                                                      |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('cx')                                        |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('cz')                                        |
|          | 462                                      | 462                                              | 1.00    | utility_scale.UtilityScaleBenchmarks.track_square_heisenberg_depth('ecr')                                       |
|          | 187±0.6ms                                | 186±1ms                                          | 0.99    | passes.MultipleBasisPassBenchmarks.time_optimize_1q_commutation(5, 1024, ['rz', 'x', 'sx', 'cx', 'id'])         |
|          | 226±3ms                                  | 223±3ms                                          | 0.99    | transpiler_levels.TranspilerLevelBenchmarks.time_quantum_volume_transpile_50_x_20(0)                            |
|          | 72.3±0.2ms                               | 71.9±0.4ms                                       | 0.99    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm(0)                                   |
|          | 81.7±0.6ms                               | 81.0±0.7ms                                       | 0.99    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm_backend_with_prop(0)                 |
|          | 10.2±0.1ms                               | 10.1±0.07ms                                      | 0.99    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('cz')                                                 |
|          | 10.3±0.09ms                              | 10.2±0.06ms                                      | 0.99    | utility_scale.UtilityScaleBenchmarks.time_parse_qaoa_n100('ecr')                                                |
|          | 35.5±0.2ms                               | 35.3±0.3ms                                       | 0.99    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('ecr')                                   |
|          | 1.48±0.01s                               | 1.47±0s                                          | 0.99    | utility_scale.UtilityScaleBenchmarks.time_qaoa('ecr')                                                           |
|          | 87.0±2ms                                 | 84.9±0.9ms                                       | 0.98    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm(1)                                   |
|          | 3.99±0.02s                               | 3.89±0.08s                                       | 0.98    | utility_scale.UtilityScaleBenchmarks.time_circSU2('ecr')                                                        |
|          | 111±1ms                                  | 108±0.8ms                                        | 0.98    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('cx')                                                  |
|          | 110±0.9ms                                | 108±1ms                                          | 0.98    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('cz')                                                  |
|          | 110±0.8ms                                | 108±1ms                                          | 0.98    | utility_scale.UtilityScaleBenchmarks.time_parse_qft_n100('ecr')                                                 |
|          | 35.7±0.1ms                               | 35.1±0.3ms                                       | 0.98    | utility_scale.UtilityScaleBenchmarks.time_parse_square_heisenberg_n100('cx')                                    |
|          | 909±10ms                                 | 878±8ms                                          | 0.97    | transpiler_levels.TranspilerLevelBenchmarks.time_quantum_volume_transpile_50_x_20(3)                            |
|          | 83.1±1ms                                 | 80.7±0.1ms                                       | 0.97    | transpiler_levels.TranspilerLevelBenchmarks.time_schedule_qv_14_x_14(0)                                         |
|          | 258±0.5ms                                | 248±2ms                                          | 0.96    | utility_scale.UtilityScaleBenchmarks.time_bv_100('ecr')                                                         |
|          | 3.91±0.02s                               | 3.74±0s                                          | 0.96    | utility_scale.UtilityScaleBenchmarks.time_circSU2('cz')                                                         |
|          | 676±3ms                                  | 651±1ms                                          | 0.96    | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('ecr')                                              |
|          | 660±7ms                                  | 629±3ms                                          | 0.95    | transpiler_levels.TranspilerLevelBenchmarks.time_quantum_volume_transpile_50_x_20(2)                            |
|          | 80.0±0.8ms                               | 74.9±0.2ms                                       | 0.94    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm_backend_with_prop(2)                 |
|          | 80.3±0.6ms                               | 75.7±0.4ms                                       | 0.94    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm_backend_with_prop(3)                 |
|          | 1.98±0.02s                               | 1.84±0.01s                                       | 0.93    | utility_scale.UtilityScaleBenchmarks.time_qaoa('cz')                                                            |
|          | 75.8±2ms                                 | 69.8±0.4ms                                       | 0.92    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm(3)                                   |
|          | 834±7ms                                  | 765±6ms                                          | 0.92    | utility_scale.UtilityScaleBenchmarks.time_square_heisenberg('cz')                                               |
|          | 74.9±0.6ms                               | 68.3±0.5ms                                       | 0.91    | transpiler_levels.TranspilerLevelBenchmarks.time_transpile_from_large_qasm(2)                                   |

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

@mtreinish mtreinish requested a review from raynelfss September 3, 2024 11:42
Copy link
Contributor

@raynelfss raynelfss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sbrandhsn and @Cryoris for working on this. LGTM!

@raynelfss raynelfss added this pull request to the merge queue Sep 3, 2024
Merged via the queue into Qiskit:main with commit df0ad77 Sep 3, 2024
15 checks passed
@raynelfss raynelfss modified the milestones: 1.3.0, 1.3 beta Nov 5, 2024
@raynelfss raynelfss added the Changelog: New Feature Include in the "Added" section of the changelog label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog performance Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port CommutationChecker to rust
8 participants