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

Convert BIPMaping transpiler pass into an external plugin #8662

Closed
3 tasks done
mtreinish opened this issue Sep 2, 2022 · 0 comments · Fixed by #9924
Closed
3 tasks done

Convert BIPMaping transpiler pass into an external plugin #8662

mtreinish opened this issue Sep 2, 2022 · 0 comments · Fixed by #9924
Labels

Comments

@mtreinish
Copy link
Member

mtreinish commented Sep 2, 2022

What should we add?

The BIPMapping transpiler pass has been in a weird state since it's introduction. It is a standalone transpiler pass that is used for both the layout and routing stage but we never integrated it into transpile because it has an external dependency on cplex which is a proprietary software package that most people don't have access too.. Now that we've added an external plugin interface for transpiler stages (which was added in #8305) we have a better option for how to advertise and use the BipMapping pass. We can create an external package for the pass that contains the code of the transpiler pass and offers a plugin that cleanly integrates into the transpile() function. Basically the workflow for using the bip mapper would change to be pip install qiskit-bip-mapper (or whatever the package name we pick is) and then doing transpile(qc, backend, layout_method="bip_mapping"). This make it easier for users to run and also separates the dependency on cplex into a separate package where we can more cleanly document the extra requirements around installing and/or purchasing a commercial license depending on the size of the circuits.

Steps:

  • Create a new package for the BipMapping pass
    • Add layout plugin for the pass
  • Deprecate BIPMapping pass in qiskit-terra after release of p
mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Dec 7, 2022
This commit updates all the layout and routing passes which leverage
hardware constraints to have a new optional keyword argument, target,
to specify a Target object for modelling the constraints of the target
backend. This option will superscede any other specified arguments for
backend constraints. For most of these passes the target argument is
just internally leveraged to build a CouplingMap (and in 2 cases a
BackendProperties) as most of the algorithms don't need more than the
global connectivity graph and there is minimal overhead to convert
from a target to a CouplingMap. The 2 passes which take backend properties
should be refactored to work natively with the target because the
conversion adds extra overhead which isn't needed, but in those cases
the passes aren't enabled by default (or are slated to be moved out of
tree as a plugin, see Qiskit#8662) so the extra overhead isn't of particular
concern.

This is part of the first step towards making all backend constraints
for the transpiler used the Target internally (see Qiskit#9256). Once all
passes that take hardware constraints parameters as an input are updated
to have a target we can start internally using the Target only for all
preset pass manager construction and start the long process of
deprecating the legacy interface in these passes.

Related to Qiskit#9256
jakelishman pushed a commit that referenced this issue Apr 6, 2023
* Make all Layout and Routing passes target aware

This commit updates all the layout and routing passes which leverage
hardware constraints to have a new optional keyword argument, target,
to specify a Target object for modelling the constraints of the target
backend. This option will superscede any other specified arguments for
backend constraints. For most of these passes the target argument is
just internally leveraged to build a CouplingMap (and in 2 cases a
BackendProperties) as most of the algorithms don't need more than the
global connectivity graph and there is minimal overhead to convert
from a target to a CouplingMap. The 2 passes which take backend properties
should be refactored to work natively with the target because the
conversion adds extra overhead which isn't needed, but in those cases
the passes aren't enabled by default (or are slated to be moved out of
tree as a plugin, see #8662) so the extra overhead isn't of particular
concern.

This is part of the first step towards making all backend constraints
for the transpiler used the Target internally (see #9256). Once all
passes that take hardware constraints parameters as an input are updated
to have a target we can start internally using the Target only for all
preset pass manager construction and start the long process of
deprecating the legacy interface in these passes.

Related to #9256

* Update pass manager drawer reference dot files

The pass manager drawer tests were comparing the dot output for statically
built pass managers to test that the output visualization is generated
correctly. However, the new arguments for the taget are changing the
visualization (to show the new option) and caused these tests to fail.
This commit updates the reference images to include the new argument.

* Fix lint

* Optimize CheckMap

This commit optimizes the logic of the CheckMap pass. Previously we were
unecessarily creating a distance matrix from the coupling graph, and
with a target unecessarily creating a CouplingMap object. Instead of
doing this instead the pass now creates a list of bidirectional edges
for adjacent nodes in the coupling graph and then a set lookup is done
for each check instead of checking for a distance of 1 in the distance
matrix.

* Fix test failures

* Update qiskit/transpiler/passes/layout/full_ancilla_allocation.py

* Add test coverage for passes not run in preset pass managers

* Fix lint

* Fix reference dot for new preset pass managers

* Rework arguments to take CouplingMap or Target

This commit updates the pass constructors to use a single positional
argument for both the coupling map or a target. This replaces the
previous behavior where a new keyword argument was added to pass in the
target. The exception to this is passes where the target was used
differently than the coupling map for extra functionality.

* Expand test coverage

* Small typo fixes from review

* Fix lint and test failure

* Update qiskit/transpiler/preset_passmanagers/level0.py

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* Update logic to favor target in all optimization levels

In an earlier commit we updated the logic in optimization level 0 to
favor target instead of a coupling map. But, that ignored the other
optimization levels. This commit corrects this oversight and adds the
same logically change to all the preset pass managers.

* Update release note for api changes in earlier iterations

* Update docstrings

* Use a single positional argument for embed pm function

---------

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Apr 6, 2023
This commit deprecates the BIPMapping transpiler pass. Since its
introduction the pass has been in a weird state since it's introduction.
It is a standalone transpiler pass that we never integrated it into
transpile() because it has an external dependency on cplex which is a
proprietary software package that most people don't have access too.
With the introduction of the transpiler stage plugin interface the pass
has been turned into an external package:

https://github.com/qiskit-community/qiskit-bip-mapper

By using the plugin interface the pass can now be cleanly integrates
into the transpile() function and also makes the requirement to have
cplex installed much more explicit. For users with cplex it's much
easier to run the BIPMapping pass as part of a transpilation workflow
with `transpile(..., routing_method="bip")`.

Closes Qiskit#8662
mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Apr 6, 2023
This commit deprecates the BIPMapping transpiler pass. Since its
introduction the pass has been in a weird state since it's introduction.
It is a standalone transpiler pass that we never integrated it into
transpile() because it has an external dependency on cplex which is a
proprietary software package that most people don't have access too.
With the introduction of the transpiler stage plugin interface the pass
has been turned into an external package:

https://github.com/qiskit-community/qiskit-bip-mapper

By using the plugin interface the pass can now be cleanly integrates
into the transpile() function and also makes the requirement to have
cplex installed much more explicit. For users with cplex it's much
easier to run the BIPMapping pass as part of a transpilation workflow
with `transpile(..., routing_method="bip")`.

Closes Qiskit#8662
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this issue Apr 16, 2023
* Make all Layout and Routing passes target aware

This commit updates all the layout and routing passes which leverage
hardware constraints to have a new optional keyword argument, target,
to specify a Target object for modelling the constraints of the target
backend. This option will superscede any other specified arguments for
backend constraints. For most of these passes the target argument is
just internally leveraged to build a CouplingMap (and in 2 cases a
BackendProperties) as most of the algorithms don't need more than the
global connectivity graph and there is minimal overhead to convert
from a target to a CouplingMap. The 2 passes which take backend properties
should be refactored to work natively with the target because the
conversion adds extra overhead which isn't needed, but in those cases
the passes aren't enabled by default (or are slated to be moved out of
tree as a plugin, see Qiskit#8662) so the extra overhead isn't of particular
concern.

This is part of the first step towards making all backend constraints
for the transpiler used the Target internally (see Qiskit#9256). Once all
passes that take hardware constraints parameters as an input are updated
to have a target we can start internally using the Target only for all
preset pass manager construction and start the long process of
deprecating the legacy interface in these passes.

Related to Qiskit#9256

* Update pass manager drawer reference dot files

The pass manager drawer tests were comparing the dot output for statically
built pass managers to test that the output visualization is generated
correctly. However, the new arguments for the taget are changing the
visualization (to show the new option) and caused these tests to fail.
This commit updates the reference images to include the new argument.

* Fix lint

* Optimize CheckMap

This commit optimizes the logic of the CheckMap pass. Previously we were
unecessarily creating a distance matrix from the coupling graph, and
with a target unecessarily creating a CouplingMap object. Instead of
doing this instead the pass now creates a list of bidirectional edges
for adjacent nodes in the coupling graph and then a set lookup is done
for each check instead of checking for a distance of 1 in the distance
matrix.

* Fix test failures

* Update qiskit/transpiler/passes/layout/full_ancilla_allocation.py

* Add test coverage for passes not run in preset pass managers

* Fix lint

* Fix reference dot for new preset pass managers

* Rework arguments to take CouplingMap or Target

This commit updates the pass constructors to use a single positional
argument for both the coupling map or a target. This replaces the
previous behavior where a new keyword argument was added to pass in the
target. The exception to this is passes where the target was used
differently than the coupling map for extra functionality.

* Expand test coverage

* Small typo fixes from review

* Fix lint and test failure

* Update qiskit/transpiler/preset_passmanagers/level0.py

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* Update logic to favor target in all optimization levels

In an earlier commit we updated the logic in optimization level 0 to
favor target instead of a coupling map. But, that ignored the other
optimization levels. This commit corrects this oversight and adds the
same logically change to all the preset pass managers.

* Update release note for api changes in earlier iterations

* Update docstrings

* Use a single positional argument for embed pm function

---------

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this issue Apr 16, 2023
…iskit#9924)

* Deprecate the BIPMapping transpiler pass in favor of external plugin

This commit deprecates the BIPMapping transpiler pass. Since its
introduction the pass has been in a weird state since it's introduction.
It is a standalone transpiler pass that we never integrated it into
transpile() because it has an external dependency on cplex which is a
proprietary software package that most people don't have access too.
With the introduction of the transpiler stage plugin interface the pass
has been turned into an external package:

https://github.com/qiskit-community/qiskit-bip-mapper

By using the plugin interface the pass can now be cleanly integrates
into the transpile() function and also makes the requirement to have
cplex installed much more explicit. For users with cplex it's much
easier to run the BIPMapping pass as part of a transpilation workflow
with `transpile(..., routing_method="bip")`.

Closes Qiskit#8662

* Catch deprecation warnings in tests

* Fix lint
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this issue May 22, 2023
* Make all Layout and Routing passes target aware

This commit updates all the layout and routing passes which leverage
hardware constraints to have a new optional keyword argument, target,
to specify a Target object for modelling the constraints of the target
backend. This option will superscede any other specified arguments for
backend constraints. For most of these passes the target argument is
just internally leveraged to build a CouplingMap (and in 2 cases a
BackendProperties) as most of the algorithms don't need more than the
global connectivity graph and there is minimal overhead to convert
from a target to a CouplingMap. The 2 passes which take backend properties
should be refactored to work natively with the target because the
conversion adds extra overhead which isn't needed, but in those cases
the passes aren't enabled by default (or are slated to be moved out of
tree as a plugin, see Qiskit#8662) so the extra overhead isn't of particular
concern.

This is part of the first step towards making all backend constraints
for the transpiler used the Target internally (see Qiskit#9256). Once all
passes that take hardware constraints parameters as an input are updated
to have a target we can start internally using the Target only for all
preset pass manager construction and start the long process of
deprecating the legacy interface in these passes.

Related to Qiskit#9256

* Update pass manager drawer reference dot files

The pass manager drawer tests were comparing the dot output for statically
built pass managers to test that the output visualization is generated
correctly. However, the new arguments for the taget are changing the
visualization (to show the new option) and caused these tests to fail.
This commit updates the reference images to include the new argument.

* Fix lint

* Optimize CheckMap

This commit optimizes the logic of the CheckMap pass. Previously we were
unecessarily creating a distance matrix from the coupling graph, and
with a target unecessarily creating a CouplingMap object. Instead of
doing this instead the pass now creates a list of bidirectional edges
for adjacent nodes in the coupling graph and then a set lookup is done
for each check instead of checking for a distance of 1 in the distance
matrix.

* Fix test failures

* Update qiskit/transpiler/passes/layout/full_ancilla_allocation.py

* Add test coverage for passes not run in preset pass managers

* Fix lint

* Fix reference dot for new preset pass managers

* Rework arguments to take CouplingMap or Target

This commit updates the pass constructors to use a single positional
argument for both the coupling map or a target. This replaces the
previous behavior where a new keyword argument was added to pass in the
target. The exception to this is passes where the target was used
differently than the coupling map for extra functionality.

* Expand test coverage

* Small typo fixes from review

* Fix lint and test failure

* Update qiskit/transpiler/preset_passmanagers/level0.py

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* Update logic to favor target in all optimization levels

In an earlier commit we updated the logic in optimization level 0 to
favor target instead of a coupling map. But, that ignored the other
optimization levels. This commit corrects this oversight and adds the
same logically change to all the preset pass managers.

* Update release note for api changes in earlier iterations

* Update docstrings

* Use a single positional argument for embed pm function

---------

Co-authored-by: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this issue May 22, 2023
…iskit#9924)

* Deprecate the BIPMapping transpiler pass in favor of external plugin

This commit deprecates the BIPMapping transpiler pass. Since its
introduction the pass has been in a weird state since it's introduction.
It is a standalone transpiler pass that we never integrated it into
transpile() because it has an external dependency on cplex which is a
proprietary software package that most people don't have access too.
With the introduction of the transpiler stage plugin interface the pass
has been turned into an external package:

https://github.com/qiskit-community/qiskit-bip-mapper

By using the plugin interface the pass can now be cleanly integrates
into the transpile() function and also makes the requirement to have
cplex installed much more explicit. For users with cplex it's much
easier to run the BIPMapping pass as part of a transpilation workflow
with `transpile(..., routing_method="bip")`.

Closes Qiskit#8662

* Catch deprecation warnings in tests

* Fix lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant