-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add stage plugin interface for transpile #8305
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
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
16c4ab6
Add stage plugin interface for transpile
mtreinish 5ec9324
Fix docs builds
mtreinish 5eca33c
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish dfeb064
Fix doc warning
mtreinish c1afe2c
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish 150c838
Make routing methods all plugins
mtreinish d900f8a
Merge branch 'main' into add-transpile-plugins
mtreinish 2839d5e
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish 19df4a0
Add plugin usage to level 3
mtreinish 0e11723
Add plugin support to level 0 preset pass manager
mtreinish fb72d1d
Add default plugin to reserved routing methods list
mtreinish 4ea9949
Add release notes
mtreinish e96b120
Add tests
mtreinish a0054ed
Apply suggestions from code review
mtreinish 0599830
Apply suggestions from code review
mtreinish 26ae3c4
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish 62b4f3f
Remove raise on non-builtin layout method argument
mtreinish a52f7ed
Fix typo
mtreinish 5dec6c8
Deduplicate code in built-in routing plugins
mtreinish adaa169
Make vf2 call limit function private
mtreinish 58f6306
Deduplicate code in stochastic swap plugin
mtreinish 7963e84
Expand example plugin documentation to show more complete use case
mtreinish b2d186d
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish 3c19b4a
Update qiskit/transpiler/preset_passmanagers/level1.py
mtreinish 2c03969
Add missing TODO comment
mtreinish e0a7d38
Unify vf2 call limit handling
mtreinish eca7f38
Merge branch 'main' into add-transpile-plugins
mtreinish 08a4972
Remove default plugin from entry points
mtreinish 4190774
Simplify level 3 optimization stage logic
mtreinish 38931c8
Update qiskit/transpiler/preset_passmanagers/plugin.py
mtreinish 9b928a0
Prefer toqm plugin if one is available
mtreinish 7b67905
Apply suggestions from code review
mtreinish 89b6d3b
Merge branch 'main' into add-transpile-plugins
mtreinish 0afc56d
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish 23a2b36
Fix lint
mtreinish 6cb6b20
Remove unnecessary elses in builtin plugins
mtreinish d756597
Apply suggestions from code review
mtreinish 7120d2d
Merge remote-tracking branch 'origin/main' into add-transpile-plugins
mtreinish d731d06
Make optimization level a plugin argument
mtreinish f185c59
Add test coverage for all built-in routing plugins
mtreinish 6d344c0
Reorder stage variables to execution order
mtreinish c4816d3
Merge branch 'main' into add-transpile-plugins
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| .. _qiskit-transpiler-plugins: | ||
|
|
||
| .. automodule:: qiskit.transpiler.passes.synthesis.plugin | ||
| .. automodule:: qiskit.transpiler.preset_passmanagers.plugin | ||
| :no-members: | ||
| :no-inherited-members: | ||
| :no-special-members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .. _qiskit-transpiler-synthesis-plugins: | ||
|
|
||
| .. automodule:: qiskit.transpiler.passes.synthesis.plugin | ||
| :no-members: | ||
| :no-inherited-members: | ||
| :no-special-members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,9 @@ def __init__( | |
| unitary_synthesis_method="default", | ||
| unitary_synthesis_plugin_config=None, | ||
| target=None, | ||
| init_method=None, | ||
| optimization_method=None, | ||
| optimization_level=None, | ||
| ): | ||
| """Initialize a PassManagerConfig object | ||
|
|
||
|
|
@@ -50,12 +53,16 @@ def __init__( | |
| coupling_map (CouplingMap): Directed graph represented a coupling | ||
| map. | ||
| layout_method (str): the pass to use for choosing initial qubit | ||
| placement. | ||
| placement. This will be the plugin name if an external layout stage | ||
| plugin is being used. | ||
| routing_method (str): the pass to use for routing qubits on the | ||
| architecture. | ||
| architecture. This will be a plugin name if an external routing stage | ||
| plugin is being used. | ||
| translation_method (str): the pass to use for translating gates to | ||
| basis_gates. | ||
| scheduling_method (str): the pass to use for scheduling instructions. | ||
| basis_gates. This will be a plugin name if an external translation stage | ||
| plugin is being used. | ||
| scheduling_method (str): the pass to use for scheduling instructions. This will | ||
| be a plugin name if an external scheduling stage plugin is being used. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any plan to replace |
||
| instruction_durations (InstructionDurations): Dictionary of duration | ||
| (in dt) for each instruction. | ||
| backend_properties (BackendProperties): Properties returned by a | ||
|
|
@@ -70,14 +77,20 @@ def __init__( | |
| :class:`~qiskit.transpiler.passes.UnitarySynthesis` pass. Will | ||
| search installed plugins for a valid method. | ||
| target (Target): The backend target | ||
| init_method (str): The plugin name for the init stage plugin to use | ||
| optimization_method (str): The plugin name for the optimization stage plugin | ||
| to use. | ||
| optimization_level (int): The optimization level being used for compilation. | ||
| """ | ||
| self.initial_layout = initial_layout | ||
| self.basis_gates = basis_gates | ||
| self.inst_map = inst_map | ||
| self.coupling_map = coupling_map | ||
| self.init_method = init_method | ||
| self.layout_method = layout_method | ||
| self.routing_method = routing_method | ||
| self.translation_method = translation_method | ||
| self.optimization_method = optimization_method | ||
| self.scheduling_method = scheduling_method | ||
| self.instruction_durations = instruction_durations | ||
| self.backend_properties = backend_properties | ||
|
|
@@ -87,6 +100,7 @@ def __init__( | |
| self.unitary_synthesis_method = unitary_synthesis_method | ||
| self.unitary_synthesis_plugin_config = unitary_synthesis_plugin_config | ||
| self.target = target | ||
| self.optimization_level = optimization_level | ||
|
|
||
| @classmethod | ||
| def from_backend(cls, backend, **pass_manager_options): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.