8000 Fix global phase update in `BasisTranslator` Pass (backport #14078) by mergify[bot] · Pull Request #14091 · Qiskit/qiskit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

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 5 commits into from
Mar 26, 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
#	test/python/transpiler/test_basis_translator.py
Copy link
Contributor Author
mergify bot commented Mar 25, 2025

Cherry-pick of d67c818 has failed:

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

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

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

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

@mergify mergify bot requested a review from a team as a code owner March 25, 2025 14:28
@mergify mergify bot added the conflicts used by mergify when there are conflicts in a port label Mar 25, 2025
@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
@raynelfss raynelfss added the on hold Can not fix yet label Mar 25, 2025
@raynelfss
Copy link
Contributor

On hold until #14097 merges

Copy link
Contributor
@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM

@ElePT ElePT enabled auto-merge March 26, 2025 14:48
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14085660796

Details

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

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/qasm2/src/expr.rs 1 94.02%
crates/qasm2/src/lex.rs 5 92.73%
Totals Coverage Status
Change from base Build 14069545950: 0.004%
Covered Lines: 79464
Relevant Lines: 89425

💛 - Coveralls

@raynelfss raynelfss removed the on hold Can not fix yet label Mar 26, 2025
@ElePT ElePT added this pull request to the merge queue Mar 26, 2025
Merged via the queue into stable/1.4 with commit 1860026 Mar 26, 2025
19 checks passed
@jakelishman jakelishman deleted the mergify/bp/stable/1.4/pr-14078 branch June 9, 2025 15:42
6E69
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.

5 participants
0