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

Parameterize Commutation Checker #13302

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MarcDrudis
Copy link
Contributor

Summary

Add support for basic parameterized gates in the commutation checker (props to @Cryoris). This is currently only done for rotation gates that have a single generator (e.g. done for RXX but not for XXPlusYY). This has the power to improve compiler quality, but also speeds up the CommutationChecker in cases where we have to check if gates are parameterized a lot.

Details and Comments

This works by replacing a parameterized gate by it's generator. For example, RZ(theta) commutes with a gate exactly if Z commutes with that gate. The special cases of theta mod 2pi = 0 are also handled. For compiling a 100-qubit QFT circuit (which has loads of CPhase gates), the runtime on my laptop was reduced as:

(main) Took 2.1887816429138183 +- 0.3050131081682874s
(this PR) Took 1.8230558633804321 +- 0.19875805494141444s

which is more than I expected given the small substitution.

@MarcDrudis MarcDrudis requested a review from a team as a code owner October 9, 2024 14:17
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Oct 9, 2024
@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

@coveralls
Copy link

coveralls commented Oct 9, 2024

Pull Request Test Coverage Report for Build 11292038109

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

  • 63 of 64 (98.44%) changed or added relevant lines in 2 files are covered.
  • 32 unchanged lines in 10 files lost coverage.
  • Overall coverage decreased (-0.2%) to 88.66%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/accelerate/src/commutation_checker.rs 62 63 98.41%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/elide_permutations.rs 1 97.06%
crates/accelerate/src/commutation_checker.rs 1 97.08%
crates/circuit/src/lib.rs 2 96.15%
crates/circuit/src/dag_circuit.rs 2 88.41%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.19%
crates/accelerate/src/check_map.rs 2 96.88%
crates/qasm2/src/lex.rs 4 92.23%
crates/accelerate/src/synthesis/multi_controlled/mcmt.rs 5 92.55%
crates/qasm2/src/parse.rs 6 96.23%
qiskit/synthesis/two_qubit/xx_decompose/decomposer.py 7 90.77%
Totals Coverage Status
Change from base Build 11241264267: -0.2%
Covered Lines: 73173
Relevant Lines: 82532

💛 - Coveralls

@mtreinish mtreinish added performance Changelog: New Feature Include in the "Added" section of the changelog Rust This PR or issue is related to Rust code in the repository mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels Oct 9, 2024
@Cryoris Cryoris self-assigned this Oct 9, 2024
Copy link
Contributor Author

@MarcDrudis MarcDrudis left a comment

Choose a reason for hiding this comment

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

I adressed the comments. Thank you for the feedback!

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 Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library performance Rust This PR or issue is related to Rust code in the repository
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

7 participants