Skip to content

Conversation

mtreinish
Copy link
Member

Summary

In the TwoQubitBasisDecomposer there was a special code path to do pulse optimal decomposition. This code path could occasionally result in a 0 degree angle rz gate being emitted. This would mean the sequence of SX - RZ(0) - SX would be generated which is just an X gate. This commit updates the decomposition to just use an X gate in these cases if they're encountered. This is essentially the same optimization that was done in #5937/#5827 for the single qubit euler decomposer but this applies it to the pulse optimal 2q decomposition.

Details and comments

In the TwoQubitBasisDecomposer there was a special code path to do pulse
optimal decomposition. This code path could occasionally result in a 0
degree angle rz gate being emitted. This would mean the sequence of SX -
RZ(0) - SX would be generated which is just an X gate. This commit
updates the decomposition to just use an X gate in these cases if
they're encountered. This is essentially the same optimization that was
done in Qiskit#5937/Qiskit#5827 for the single qubit euler decomposer but this
applies it to the pulse optimal 2q decomposition.
@mtreinish mtreinish added this to the 2.2.0 milestone Jun 17, 2025
@mtreinish mtreinish requested a review from a team as a code owner June 17, 2025 14:31
@mtreinish mtreinish added performance Changelog: None Do not include in changelog labels Jun 17, 2025
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core
  • @levbishop

@coveralls
Copy link

coveralls commented Jun 17, 2025

Pull Request Test Coverage Report for Build 16630282067

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

  • 17 of 17 (100.0%) changed or added relevant lines in 1 file are covered.
  • 13 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 87.769%

Files with Coverage Reduction New Missed Lines %
crates/circuit/src/symbol_expr.rs 1 73.69%
crates/qasm2/src/lex.rs 6 91.75%
crates/qasm2/src/parse.rs 6 97.09%
Totals Coverage Status
Change from base Build 16607038887: -0.01%
Covered Lines: 81430
Relevant Lines: 92778

💛 - 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.

would you like to add a test? other than that, looks good!

@mtreinish mtreinish removed their assignment Jul 3, 2025
@mtreinish
Copy link
Member Author

would you like to add a test? other than that, looks good!

I added tests in: b41e62d

@mtreinish mtreinish requested a review from ShellyGarion July 30, 2025 18:07
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 for fixing this bug!
and thanks to @t-imamichi for finding it!

@ShellyGarion ShellyGarion added this pull request to the merge queue Aug 7, 2025
Merged via the queue into Qiskit:main with commit 93d9e75 Aug 7, 2025
26 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 performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants