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

Fix post-oxidization change in ConsolidateBlocks behavior (backport #13450) #13453

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 18, 2024

Summary

Fixes the behavioral difference introduced by #13368 that caused #13438.

The original implementation of the pass used to set the ConsolidateBlocks internal decomposer calling unitary_synthesis._decomposer_2q_from_basis_gates, which, when kak_basis wasn't found, would return None. During the oxidization efforts, unitary_synthesis._decomposer_2q_from_basis_gates was replaced with inline code that didn't contemplate this path (always set a default decomposer), which in the reproducing example lead to a longer output circuit (the gates were collected into a unitary block and then decomposed differently).

Details and comments

Technically not a bugfix because the change wasn't released yet.

Using the example shown in the issue ->

ConsolidateBlocks output dag with 1.2.4:
image

ConsolidateBlocks output dag with 1.3.0rc1:
image

ConsolidateBlocks output dag after this fix:
image


This is an automatic backport of pull request #13450 done by [Mergify](https://mergify.com).

* Set decomposer to None if kak_gates not found during ConsolidateBlocks initialization.

* Add test that reproduces issue

* Re-add rzz to list of kak gates

* Add path for rzx gate.

(cherry picked from commit 94cea41)
@mergify mergify bot requested a review from a team as a code owner November 18, 2024 23:30
@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

@github-actions github-actions bot added the Changelog: None Do not include in changelog label Nov 18, 2024
@github-actions github-actions bot added this to the 1.3.0 milestone Nov 18, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11903054996

Details

  • 4 of 5 (80.0%) changed or added relevant lines in 1 file are covered.
  • 12 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.01%) to 88.91%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/optimization/consolidate_blocks.py 4 5 80.0%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 92.2%
qiskit/transpiler/passes/optimization/consolidate_blocks.py 1 96.36%
crates/qasm2/src/lex.rs 4 91.48%
crates/qasm2/src/parse.rs 6 96.69%
Totals Coverage Status
Change from base Build 11844407790: -0.01%
Covered Lines: 79049
Relevant Lines: 88909

💛 - Coveralls

@ElePT ElePT added this pull request to the merge queue Nov 19, 2024
Merged via the queue into stable/1.3 with commit 3c20e1a Nov 19, 2024
19 of 20 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants