8000 Remove use of `BackendProperties` (BackendV1) in transpiler pipeline by ElePT · Pull Request #13722 · Qiskit/qiskit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove use of BackendProperties (BackendV1) in transpiler pipeline #13722

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 3 commits into from
Feb 18, 2025

Conversation

ElePT
Copy link
Contributor
@ElePT ElePT commented Jan 22, 2025

Summary

This PR removes the following uses of BackendProperties deprecated in #13719:

  • backend_prop input argument in DenseLayout
  • properties input argument in VF2Layout
  • properties input argument in VF2PostLayout
  • backend_props input argument in UnitarySynthesis
  • backend_properties in PassManagerConfig
  • backend_properties in generate_routing_passmanager
  • backend_properties in generate_translation_passmanager
  • backend_properties in Target.from_configuration

as well as the previously deprecated input arguments of transpile, generate_preset_pass_manager.

Details and comments

Currently on hold as it contains the changes from #13706, should be rebased after it's merged.

Contributes to #13708.

@ElePT ElePT added the on hold Can not fix yet label Jan 22, 2025
@ElePT ElePT requested review from alexanderivrii, ShellyGarion and a team as code owners January 22, 2025 16:52
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@ElePT ElePT changed the title Remove v1 props transpiler Remove use of BackendProperties (BackendV1) in transpiler pipeline Jan 22, 2025
@ElePT ElePT added this to the 2.0.0 milestone Jan 22, 2025
@ElePT ElePT added the Changelog: Removal Include in the Removed section of the changelog label Jan 22, 2025
@coveralls
Copy link
coveralls commented Jan 22, 2025

Pull Request Test Coverage Report for Build 13388802659

Details

  • 35 of 48 (72.92%) changed or added relevant lines in 6 files are covered.
  • 93 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.06%) to 88.117%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/layout/vf2_post_layout.py 29 42 69.05%
Files with Coverage Reduction New Missed Lines %
qiskit/providers/models/backendproperties.py 1 94.74%
qiskit/transpiler/preset_passmanagers/builtin_plugins.py 1 95.73%
crates/accelerate/src/unitary_synthesis.rs 2 94.29%
crates/qasm2/src/lex.rs 6 92.23%
qiskit/transpiler/passes/layout/vf2_post_layout.py 9 80.54%
qiskit/providers/backend_compat.py 16 80.0%
qiskit/transpiler/target.py 58 69.45%
Totals Coverage Status
Change from base Build 13376164595: -0.06%
Covered Lines: 78620
Relevant Lines: 89222

💛 - Coveralls

@ElePT ElePT force-pushed the remove-v1-props-transpiler branch from f0958f1 to 25bf326 Compare February 7, 2025 14:24
@ElePT ElePT removed the on hold Can not fix yet label Feb 7, 2025
Copy link
Member
@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This LGTM, one inline question about a removed test but outside of that I think this is good to merge.

Comment on lines -590 to -597
def test_no_backend_properties(self):
"""Test we raise at runtime if no properties are provided with a coupling graph."""
qc = QuantumCircuit(2)
empty_pass = VF2PostLayout(
coupling_map=CouplingMap([(0, 1), (1, 2)]), strict_direction=False
)
with self.assertRaises(TranspilerError):
empty_pass.run(circuit_to_dag(qc))
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this test still valid without backend properties? Shouldn't the pass fail if we provide a coupling map with no error rates to use?

Copy link
Contributor Author
@ElePT ElePT Feb 11, 2025

Choose a reason for hiding this comment

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

I thought about removing coupling_map from the VF2PostLayout pass because of this test, because it really cannot be used without backend properties. Then I went for not erroring when only a coupling map is provided, I think I checked that it simply didn't return a solution. I am now standing somewhere between the two, the only advantage of still accepting the argument I guess is some kind of compatibility angle?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it'd mostly be a compatibility question. From a practical PoV VF2Layout works with just a coupling map and for the error heuristic it uses node degree in the connectivity graph as a proxy for error (so a more connected node is avoided). For VF2PostLayout that is unlikely to have an impact because most coupling maps are regular lattices so the degrees won't differ that much.

The one case I could see it making a difference is like if the interaction graph of the post routing circuit was a line you could maybe snake the line over boundary nodes in the lattice that have a smaller degree. Something like:

im graph:

0 - 1 - 2 - 3 -4

cmap:

0 - 1 - 2 - 3
|   |    |  |
4 - 5 - 6 - 7
|   |    |  |
8 - 9 - 10 -11

if you used the node degree the mapping would favor putting the line that maximized the number of nodes on 0, 3, 8, and 11 in the cmap. Whether this is good behavior for VF2PostLayout is debatable though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm ok, even though that use case doesn't come up much in practice now, I think the most "behavior preserving" path regarding this removal is erroring on the coupling map.

…used if backend properties were present. After the removal of the latter, the coupling_map would always be overwritten by the target.
@ElePT
Copy link
Contributor Author
ElePT commented Feb 18, 2025

After a bit of back and forth between the different removal alternatives in VF2PostLayout, I settled for removing the coupling_map input argument. Unlike VF2Layout, which might use coupling_map in the presence of a target if the target is missing the connectivity information, VF2PostLayout had no use for it as a standalone input. The version change seems like a good opportunity to get rid of both inputs as a "pack". I updated the deprecation in #13719 to include the coupling_map and removed it in fe772b9.

Copy link
Member
@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

This LGTM now thanks for doing all of the work on this.

"A target must be specified or a coupling map and properties must be provided"
)
if self.target is None:
raise TranspilerError("A target must be specified or a coupling map must be provided")
8000 Copy link
Member

Choose a reason for hiding this comment

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

This threw me for a second until I remember these passes should be instantiable even if the required target isn't specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I also spent a long time thinking if I should make it a required argument.

@mtreinish mtreinish added this pull request to the merge queue Feb 18, 2025
Merged via the queue into Qiskit:main with commit d9b8a18 Feb 18, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Removal Include in the Removed section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0