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 synth_cnot_count_full_pmh #12588

Merged
merged 3 commits into from
Jul 4, 2024
Merged

Oxidize synth_cnot_count_full_pmh #12588

merged 3 commits into from
Jul 4, 2024

Conversation

Cryoris
Copy link
Contributor

@Cryoris Cryoris commented Jun 17, 2024

Summary

Closes #12227.

In a benchmark to synthesize 100 qubit linear networks 1000 times, the runtime is ~44 times faster:

(main) Took 172.75505709648132s
(this PR) Took 3.920625925064087s

I would assume the main speedup is due to a more efficient circuit construction.

Details and comments

@Cryoris Cryoris added performance Rust This PR or issue is related to Rust code in the repository labels Jun 17, 2024
@qiskit-bot
Copy link
Collaborator

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

@coveralls
Copy link

coveralls commented Jun 17, 2024

Pull Request Test Coverage Report for Build 9547358808

Details

  • 115 of 115 (100.0%) changed or added relevant lines in 5 files are covered.
  • 6 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.05%) to 89.764%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 6 92.11%
Totals Coverage Status
Change from base Build 9514566193: 0.05%
Covered Lines: 63489
Relevant Lines: 70729

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 17, 2024

Pull Request Test Coverage Report for Build 9548795140

Details

  • 115 of 115 (100.0%) changed or added relevant lines in 5 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.06%) to 89.769%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 2 93.38%
Totals Coverage Status
Change from base Build 9514566193: 0.06%
Covered Lines: 63491
Relevant Lines: 70727

💛 - Coveralls

Copy link
Member

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

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

Generally, it looks very well. Please see some comments and questions.
Also, release notes are needed.

crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/lib.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9592962940

Details

  • 113 of 113 (100.0%) changed or added relevant lines in 5 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.02%) to 89.776%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 5 92.88%
crates/qasm2/src/parse.rs 6 97.61%
Totals Coverage Status
Change from base Build 9585515412: 0.02%
Covered Lines: 63645
Relevant Lines: 70893

💛 - Coveralls

@ShellyGarion ShellyGarion added this to the 1.2.0 milestone Jun 20, 2024
@coveralls
Copy link

coveralls commented Jun 20, 2024

Pull Request Test Coverage Report for Build 9600662838

Warning: This coverage report may be inaccurate.

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.

Details

  • 116 of 116 (100.0%) changed or added relevant lines in 5 files are covered.
  • 45 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 89.724%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 5 92.11%
crates/qasm2/src/parse.rs 12 96.23%
qiskit/visualization/pulse_v2/device_info.py 28 39.71%
Totals Coverage Status
Change from base Build 9585515412: -0.03%
Covered Lines: 63627
Relevant Lines: 70914

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 21, 2024

Pull Request Test Coverage Report for Build 9609475087

Warning: This coverage report may be inaccurate.

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.

Details

  • 113 of 113 (100.0%) changed or added relevant lines in 5 files are covered.
  • 54 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.006%) to 89.762%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.02%
crates/qasm2/src/lex.rs 2 93.13%
qiskit/circuit/quantumcircuit.py 23 95.69%
qiskit/visualization/pulse_v2/device_info.py 28 39.71%
Totals Coverage Status
Change from base Build 9585515412: 0.006%
Covered Lines: 63652
Relevant Lines: 70912

💛 - Coveralls

Copy link
Member

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

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

This code looks good, but it should be refactored as #12456 was merged.

My main comment is that perhaps we should consider incorporating the suggestion in
#12166 (comment) to handle invalid values section_size as well as tests to verify the correctness of the valid circuit (see #12166 (comment)).
Then, perhaps it would be better to have the default section_size as log(n) since it produces a circuit with smaller CX count.

crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/cnot_synthesis.rs Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jul 3, 2024

Pull Request Test Coverage Report for Build 9781347471

Details

  • 113 of 113 (100.0%) changed or added relevant lines in 3 files are covered.
  • 12 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.003%) to 89.843%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.02%
crates/qasm2/src/lex.rs 5 91.86%
crates/qasm2/src/parse.rs 6 97.61%
Totals Coverage Status
Change from base Build 9780558630: 0.003%
Covered Lines: 65198
Relevant Lines: 72569

💛 - Coveralls

Copy link
Member

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

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

Thanks @Cryoris - this PR looks great, I have some small comments.

qiskit/synthesis/linear/cnot_synth.py Outdated Show resolved Hide resolved
test/python/synthesis/test_linear_synthesis.py Outdated Show resolved Hide resolved
test/python/synthesis/test_linear_synthesis.py Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

The code looks amazing! I just had one tiny question about function arguments.

crates/accelerate/src/synthesis/linear/pmh.rs Outdated Show resolved Hide resolved
crates/accelerate/src/synthesis/linear/pmh.rs Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jul 4, 2024

Pull Request Test Coverage Report for Build 9791122293

Warning: This coverage report may be inaccurate.

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.

Details

  • 113 of 113 (100.0%) changed or added relevant lines in 3 files are covered.
  • 12 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.01%) to 89.85%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 92.11%
crates/circuit/src/circuit_data.rs 9 90.73%
Totals Coverage Status
Change from base Build 9780558630: 0.01%
Covered Lines: 65199
Relevant Lines: 72564

💛 - Coveralls

Copy link
Member

@ShellyGarion ShellyGarion left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @Cryoris !

@Cryoris Cryoris added this pull request to the merge queue Jul 4, 2024
Merged via the queue into Qiskit:main with commit 722a5bc Jul 4, 2024
15 checks passed
@Cryoris Cryoris deleted the rust/pmh branch July 10, 2024 09:50
@ElePT ElePT added Changelog: Bugfix Include in the "Fixed" section of the changelog Changelog: New Feature Include in the "Added" section of the changelog labels Jul 30, 2024
Procatv pushed a commit to Procatv/qiskit-terra-catherines that referenced this pull request Aug 1, 2024
* port PMH synth to Rust

* Raise an error if the section size is invalid

Co-authored-by: Abdalla01001 <[email protected]>
Co-authored-by: Tarun-Kumar07 <[email protected]>

* Review comments of Shelly & Sasha

---------

Co-authored-by: Abdalla01001 <[email protected]>
Co-authored-by: Tarun-Kumar07 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog 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 synthesis
Projects
None yet
6 participants