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

Remove use of BackendProperties (BackendV1) in UnitarySynthesis pass #13706

Merged
merged 6 commits into from
Feb 7, 2025

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented Jan 21, 2025

Summary

This PR includes:

  • Test upgrade -> Upgrade of class unit tests to avoid use of Backend V1. Some tests were also modified to use target instead of basis_gates, as the functionality they were testing was dependant of the backend_props input (deprecated)
  • Removal -> Removed the backend_props argument from UnitarySynthesis, as it relied on the deprecated BackendProperties class. The argument itself was never deprecated, so it might be necessary to open a deprecation PR against 1.4.

Note that this PR touches on code that is currently actively worked on in:

And there will be conflicts.

Details and comments

@ElePT ElePT added the Changelog: Removal Include in the Removed section of the changelog label Jan 21, 2025
@ElePT ElePT added this to the 2.0.0 milestone Jan 21, 2025
@coveralls
Copy link

coveralls commented Jan 21, 2025

Pull Request Test Coverage Report for Build 13198658824

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • 20 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.006%) to 88.605%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 4 92.48%
crates/qasm2/src/parse.rs 6 97.61%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 10 56.17%
Totals Coverage Status
Change from base Build 13188570701: 0.006%
Covered Lines: 79308
Relevant Lines: 89507

💛 - Coveralls

@ElePT ElePT marked this pull request as ready for review January 21, 2025 15:20
@ElePT ElePT requested review from alexanderivrii, ShellyGarion and a team as code owners January 21, 2025 15:20
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@ElePT
Copy link
Contributor Author

ElePT commented Jan 21, 2025

Marked as on hold to make sure I have a 1.4 deprecation ready before merging this PR.

@ElePT
Copy link
Contributor Author

ElePT commented Jan 22, 2025

No longer on hold after #13719

Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

Overall LGTM, I just have two small, non-logic-touching comments 🙂

Comment on lines 9 to 10
This argument required a ``BackendProperties`` object, deprecated since qiskit 1.2, as it
belonged to the deprecated BackendV1 workflow. Constraints such as gate error and durations
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to mention that BackendProperties is removed in this release?

Suggested change
This argument required a ``BackendProperties`` object, deprecated since qiskit 1.2, as it
belonged to the deprecated BackendV1 workflow. Constraints such as gate error and durations
This argument required a ``BackendProperties`` object, deprecated since Qiskit 1.2, as it
belonged to the deprecated ``BackendV1`` workflow. Constraints such as gate error and durations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wrote the reno before #13722, which completes the removal... it is a bit weird to have UnitarySynthesis singled out, so I am thinking... should we remove the reno alltogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to remove the reno, as the changes are already reflected in the reno of #13722. I will change the label to Changelog:None to make sure there are no issues with the release bot.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, it should all be in a single reno to understand what's going on 👍

@@ -952,6 +849,88 @@ def test_determinism(self):
for basis_gate in basis_gates:
self.assertLessEqual(out.count_ops()[basis_gate], gate_counts[basis_gate])

@combine(gate=["unitary", "swap"], natural_direction=[True, False])
def test_two_qubit_synthesis_to_directional_cx_target(self, gate, natural_direction):
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we merge these tests with the target-free versions above by adding e.g. a third argument via_target=True/False that then builds a Target or not inside? Then we could reduce the duplication 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but not all the tests have an equivalent on the other class, so the unification would take a bit of work. I think that would be out of scope for this PR.

@ElePT ElePT added Changelog: None Do not include in changelog and removed Changelog: Removal Include in the Removed section of the changelog labels Feb 6, 2025
@ShellyGarion
Copy link
Member

ShellyGarion commented Feb 7, 2025

LGTM (except of the failing tests that should be updated).
I found the word "backend" still mentioned in some docs - should it be "target"?

"""Find the matching basis string keys from the list of basis gates from the backend."""

coupling_map (CouplingMap): the coupling map of the backend

@ElePT ElePT force-pushed the remove-v1-unitary-synth branch from 00bee06 to 6e2a4c2 Compare February 7, 2025 08:55
@ElePT
Copy link
Contributor Author

ElePT commented Feb 7, 2025

Yeah I don't know why the tests started failing on CI, they all pass locally and on previous CI runs, the lines that are reported to fail don't exist so I think it must be a small glitch. I re-pushed things to trigger the tests again.

@ElePT
Copy link
Contributor Author

ElePT commented Feb 7, 2025

@jakelishman helped me understand the mysterious source of the errors: the CI jobs don’t actually run on the PR HEAD, they run on the merge of the PR HEAD and main (unless there's a conflict), and this was causing the strange untraceable failures. Should be fixed now.

@Cryoris Cryoris added this pull request to the merge queue Feb 7, 2025
Merged via the queue into Qiskit:main with commit f2234fc Feb 7, 2025
17 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.

5 participants