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

Avoid operator creation in transpiler (backport #12826) #12875

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jul 31, 2024

Summary

This removes very nearly all of the use of DAGOpNode.op in the default transpiler paths. The sole exception is in InverseCancellation, which currently would involve some quite awkward gymnastics for little near-term benefit. The pass should move fully to Rust soon, making it not worth the effort.

Most of the tricks here involve using the knowledge that most operations will involve only Rust-space standard gates, and that these cannot be control-flow operations.

Details and comments

This always includes a reno for a couple of the new methods added to DAGOpNode and CircuitInstruction.

I measured this as being ~25% faster for some toy workloads at transpilation levels 0 and 1, probably mostly driven by the new methods letting us avoid a lot of isinstance checks in most cases.


This is an automatic backport of pull request #12826 done by Mergify.

* Avoid operator creation in transpiler

This removes very nearly all of the use of `DAGOpNode.op` in the default
transpiler paths.  The sole exception is in `InverseCancellation`, which
currently would involve some quite awkward gymnastics for little
near-term benefit. The pass should move fully to Rust soon, making it
not worth the effort.

Most of the tricks here involve using the knowledge that most operations
will involve only Rust-space standard gates, and that these cannot be
control-flow operations.

* Fix `HighLevelSynthesis` fast path

---------

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
(cherry picked from commit 0afb06e)
@mergify mergify bot requested review from alexanderivrii, ShellyGarion and a team as code owners July 31, 2024 19:55
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

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

@github-actions github-actions bot added Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler labels Jul 31, 2024
@github-actions github-actions bot added this to the 1.2.0 milestone Jul 31, 2024
@mtreinish mtreinish enabled auto-merge July 31, 2024 19:56
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10186771068

Details

  • 108 of 114 (94.74%) changed or added relevant lines in 15 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.07%) to 89.903%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/synthesis/high_level_synthesis.py 25 26 96.15%
crates/circuit/src/circuit_instruction.rs 11 16 68.75%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/basis/basis_translator.py 1 97.44%
crates/qasm2/src/lex.rs 3 92.48%
Totals Coverage Status
Change from base Build 10185760581: 0.07%
Covered Lines: 66532
Relevant Lines: 74004

💛 - Coveralls

@mtreinish mtreinish added this pull request to the merge queue Jul 31, 2024
Merged via the queue into stable/1.2 with commit 353b0ea Jul 31, 2024
18 checks passed
@mergify mergify bot deleted the mergify/bp/stable/1.2/pr-12826 branch July 31, 2024 21:44
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 mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants