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

Restrict iteration of commutation passes to just qubits #12318

Merged
merged 1 commit into from
May 2, 2024

Conversation

mtreinish
Copy link
Member

Summary

The CommutativeCancellation and CommutationAnalysis passes were previously iterating over the full set of wires in the DAGCircuit. However the wire list contains classical bits and also classical variables after #12204 merges. The only thing these passes are concerned about are computing whether quantum operations commute and therefore don't need to work with any classical components in the DAG. In general these exta iterations were just no-ops because there wouldn't be anything evaluated on the wires, but doing this will avoid any potential overhead and limiting the search space to just where there is potential work to do.

Details and comments

The CommutativeCancellation and CommutationAnalysis passes were
previously iterating over the full set of wires in the DAGCircuit.
However the wire list contains classical bits and also classical
variables after Qiskit#12204 merges. The only thing these passes are concerned
about are computing whether quantum operations commute and therefore
don't need to work with any classical components in the DAG. In general
these exta iterations were just no-ops because there wouldn't be
anything evaluated on the wires, but doing this will avoid any potential
overhead and limiting the search space to just where there is potential
work to do.
@mtreinish mtreinish added performance Changelog: None Do not include in changelog mod: transpiler Issues and PRs related to Transpiler labels May 1, 2024
@mtreinish mtreinish added this to the 1.1.0 milestone May 1, 2024
@mtreinish mtreinish requested a review from a team as a code owner May 1, 2024 12:06
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

Pull Request Test Coverage Report for Build 8909094749

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

  • 3 of 3 (100.0%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.03%) to 89.519%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/expr.rs 1 94.03%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
crates/qasm2/src/lex.rs 2 92.88%
Totals Coverage Status
Change from base Build 8908667024: 0.03%
Covered Lines: 61374
Relevant Lines: 68560

💛 - Coveralls

@jakelishman jakelishman added this pull request to the merge queue May 1, 2024
Merged via the queue into Qiskit:main with commit 9367f7b May 2, 2024
15 checks passed
ElePT pushed a commit to ElePT/qiskit that referenced this pull request May 31, 2024
The CommutativeCancellation and CommutationAnalysis passes were
previously iterating over the full set of wires in the DAGCircuit.
However the wire list contains classical bits and also classical
variables after Qiskit#12204 merges. The only thing these passes are concerned
about are computing whether quantum operations commute and therefore
don't need to work with any classical components in the DAG. In general
these exta iterations were just no-ops because there wouldn't be
anything evaluated on the wires, but doing this will avoid any potential
overhead and limiting the search space to just where there is potential
work to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog mod: transpiler Issues and PRs related to Transpiler performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants