Skip to content

Fix global phase update in BasisTranslator Pass (backport #14078) #14092

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

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 25, 2025

Summary

Fixes #14074.

The basis_translator pass was not always updating the DAG's global phase as a part of replace_node: this was only done when the target dag's global phase matched Param::ParameterExpression. Updating the global phase in the case of Param::Float was missing, and this is fixed now.

I am somewhat unsure if we also need to handle the Param::Obj case. I don't understand in what kind of a circuit we would see this, and I don't believe it's even supported, as per dag_circuit.rs.add_global_phase, which throws an error in the case of Param::Obj. Update: @jakelishman confirmed that Param::Obj is never permitted in global_phase.

Update: added release notes.


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

* add missing branch for global phase update in basis_translator

* Adding test

* reno

(cherry picked from commit d67c818)

# Conflicts:
#	crates/accelerate/src/basis/basis_translator/mod.rs
@mergify mergify bot requested a review from a team as a code owner March 25, 2025 14:29
@mergify mergify bot added the conflicts used by mergify when there are conflicts in a port label Mar 25, 2025
Copy link
Contributor Author

mergify bot commented Mar 25, 2025

Cherry-pick of d67c818 has failed:

On branch mergify/bp/stable/2.0/pr-14078
Your branch is up to date with 'origin/stable/2.0'.

You are currently cherry-picking commit d67c8182b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   releasenotes/notes/fix-global-phase-in-basis-translator-d08d665198589828.yaml
	modified:   test/python/transpiler/test_basis_translator.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   crates/accelerate/src/basis/basis_translator/mod.rs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@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: Bugfix Include in the "Fixed" section of the changelog label Mar 25, 2025
@github-actions github-actions bot added this to the 2.0.0 milestone Mar 25, 2025
@raynelfss raynelfss self-assigned this Mar 25, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14063868485

Details

  • 25 of 29 (86.21%) changed or added relevant lines in 1 file are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.01%) to 88.053%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/accelerate/src/basis/basis_translator/mod.rs 25 29 86.21%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 94.79%
crates/qasm2/src/lex.rs 3 91.98%
Totals Coverage Status
Change from base Build 14060588661: 0.01%
Covered Lines: 72708
Relevant Lines: 82573

💛 - Coveralls

@raynelfss raynelfss added this pull request to the merge queue Mar 25, 2025
Merged via the queue into stable/2.0 with commit 45c908a Mar 25, 2025
22 checks passed
@jakelishman jakelishman deleted the mergify/bp/stable/2.0/pr-14078 branch June 9, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog conflicts used by mergify when there are conflicts in a port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants