-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Increase documentation of built-in transpiler plugins #13620
Conversation
This overhauls how the `qiskit.transpiler` documentation talks about the transpiler plugins. All of the built-in plugins now have a decent amount of overview documentation, and the requirements and expectations for each stage of the preset pipelines is explained in more detail. This form of the documentation makes the distinction between "a compilation routine in general" and "Qiskit's specific choice of default pipeline" clearer, to avoid confusion for advanced users. Much of the guide-level explanations of the different preset pipeline stages moved to https://docs.quantum.ibm.com some time ago, so this PR removes those, in favour of focussing on the actual API, and inserts links to learn more about the principles elsewhere. The guide-level explanation of scheduling is left in-place for now, because the content on the other parts of the IBM documentation isn't as complete for that.
One or more of the following people are relevant to this code:
|
Docs team: as of right now, we don't necessarily need to bother copy-editing - first I need to get sign-off from the rest of the compiler team that this is the appropriate level of detail for us to document, and doesn't over-tie our hands with respect to the stability policy. If you guys have any comments about the high-level content, that's very welcome immediately. |
Pull Request Test Coverage Report for Build 13160133967Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jake! I have taken a look to the introduction up to the init stage details and left a few comments. I will try to finish the review later today :)
Co-authored-by: Elena Peña Tapia <[email protected]>
Yeah, this I know, I guess it's just because I usually write "1q gates" (and so on). I'm so used to reading the numerals in this specific case that the words feel funny to me, even though I don't use numerals in other small-number situations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great - thanks, Jake!
The final layout permutation is caused by :class:`~.SwapGate` insertion during | ||
the :ref:`routing_stage`. This class provides an interface to reason about these | ||
permutations using a variety of helper methods. | ||
the :ref:`transpiler-preset-stage-routing`. This class provides an interface to reason about |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the :ref:`transpiler-preset-stage-routing`. This class provides an interface to reason about | |
the :ref:`transpiler-preset-stage-routing`. This class provides an interface to understand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"reason about" here I think is meaning more about the idea of using programmatic logic on the output, rather than a user sitting and thinking - "understand" isn't quite right, but "reason about" is something we say
|
||
The scheduling stage, if requested, is responsible for inserting explicit :class:`~.circuit.Delay` | ||
instructions to make idle periods of qubits explicit. Plugins may optionally choose to do | ||
walltime-sensitive transformations, such as inserting dynamical decoupling sequences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
walltime-sensitive transformations, such as inserting dynamical decoupling sequences. | |
wall clock time-sensitive transformations, such as inserting dynamical decoupling sequences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"walltime" is an equally common spelling of this, and I think we'd end up with "wall-clock-time-sensitive" if we did that, which seems a bit verbose
Co-authored-by: Rebecca Dimock <[email protected]>
Co-authored-by: Rebecca Dimock <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot Jake, this is a great improvement on the previous docs. I managed to finally finish reading it and suggested a few minor changes, other than that LGTM.
Higher-level user-facing explanation of the layout stage in the IBM Quantum guide. | ||
|
||
The layout stage is responsible for making an initial mapping between the virtual qubits of the | ||
input circuit, and the hardware qubits of the target. This includes expanding the input circuit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we could also introduce "physical qubits" here, or is this a term we prefer to avoid? (I never keep up with these trends)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the qiskit.circuit
documentation, we define "physical qubit" to be one type of "hardware qubit" (the other is a "logical qubit"). In those terms, the compiler deals in "hardware qubits", because it doesn't care if the Target
was presented as a low-level Target
(as it always is right now) or a logical-qubit Target
(as it one day may be).
If you write your own layout plugin, you might find :func:`.generate_embed_passmanager` useful for | ||
automating the "embedding" stage of the layout application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just learned something new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha yeah - I've seen too many people struggle with this, so I thought it was useful to call it out
This section is still here because the content hasn't fully migrated to other places yet, unlike | ||
other discussions of the components of quantum compilation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just going to comment on this (I was looking at the rendered version), good clarification.
Co-authored-by: Elena Peña Tapia <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I will not add the PR to the queue yet in case @beckykd has any final comments, but I think it's good to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this LGTM too, I left a few small questions inline but nothing worth blocking over. If you don't feel there is anything to change related to my questions I think we can enqueue this for merging.
|
||
.. note:: | ||
|
||
In Qiskit 1.x, translation plugins need not output gates with the correct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implies the intent to change this in Qiskit 2.0? Is there a tracking issue or PR for this? I worry if we're not tracking it < 1 month away from the feature freeze we'll lose the thread on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning on doing it - I've got it written on my todo list. I've opened a proper tracking issue at #13787.
* Increase documentation of built-in transpiler plugins This overhauls how the `qiskit.transpiler` documentation talks about the transpiler plugins. All of the built-in plugins now have a decent amount of overview documentation, and the requirements and expectations for each stage of the preset pipelines is explained in more detail. This form of the documentation makes the distinction between "a compilation routine in general" and "Qiskit's specific choice of default pipeline" clearer, to avoid confusion for advanced users. Much of the guide-level explanations of the different preset pipeline stages moved to https://docs.quantum.ibm.com some time ago, so this PR removes those, in favour of focussing on the actual API, and inserts links to learn more about the principles elsewhere. The guide-level explanation of scheduling is left in-place for now, because the content on the other parts of the IBM documentation isn't as complete for that. * Fix cross references in release notes * Include Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply copy-editing suggestions Co-authored-by: abbycross <[email protected]> * Add manual copy-editing suggestions * Reflow text * Copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Add missed copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Reflow line breaks * Apply Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply Elena's suggestions that needed line wraps * Correct layout description * Mark stochastic plugin as deprecated --------- Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: abbycross <[email protected]> Co-authored-by: Rebecca Dimock <[email protected]> (cherry picked from commit 4d2265f) # Conflicts: # qiskit/transpiler/__init__.py
* Increase documentation of built-in transpiler plugins This overhauls how the `qiskit.transpiler` documentation talks about the transpiler plugins. All of the built-in plugins now have a decent amount of overview documentation, and the requirements and expectations for each stage of the preset pipelines is explained in more detail. This form of the documentation makes the distinction between "a compilation routine in general" and "Qiskit's specific choice of default pipeline" clearer, to avoid confusion for advanced users. Much of the guide-level explanations of the different preset pipeline stages moved to https://docs.quantum.ibm.com some time ago, so this PR removes those, in favour of focussing on the actual API, and inserts links to learn more about the principles elsewhere. The guide-level explanation of scheduling is left in-place for now, because the content on the other parts of the IBM documentation isn't as complete for that. * Fix cross references in release notes * Include Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply copy-editing suggestions Co-authored-by: abbycross <[email protected]> * Add manual copy-editing suggestions * Reflow text * Copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Add missed copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Reflow line breaks * Apply Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply Elena's suggestions that needed line wraps * Correct layout description * Mark stochastic plugin as deprecated --------- Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: abbycross <[email protected]> Co-authored-by: Rebecca Dimock <[email protected]> (cherry picked from commit 4d2265f)
* Increase documentation of built-in transpiler plugins This overhauls how the `qiskit.transpiler` documentation talks about the transpiler plugins. All of the built-in plugins now have a decent amount of overview documentation, and the requirements and expectations for each stage of the preset pipelines is explained in more detail. This form of the documentation makes the distinction between "a compilation routine in general" and "Qiskit's specific choice of default pipeline" clearer, to avoid confusion for advanced users. Much of the guide-level explanations of the different preset pipeline stages moved to https://docs.quantum.ibm.com some time ago, so this PR removes those, in favour of focussing on the actual API, and inserts links to learn more about the principles elsewhere. The guide-level explanation of scheduling is left in-place for now, because the content on the other parts of the IBM documentation isn't as complete for that. * Fix cross references in release notes * Include Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply copy-editing suggestions Co-authored-by: abbycross <[email protected]> * Add manual copy-editing suggestions * Reflow text * Copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Add missed copy edit Co-authored-by: Rebecca Dimock <[email protected]> * Reflow line breaks * Apply Elena's suggestions Co-authored-by: Elena Peña Tapia <[email protected]> * Apply Elena's suggestions that needed line wraps * Correct layout description * Mark stochastic plugin as deprecated --------- Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: abbycross <[email protected]> Co-authored-by: Rebecca Dimock <[email protected]> (cherry picked from commit 4d2265f) Co-authored-by: Jake Lishman <[email protected]>
Summary
This overhauls how the
qiskit.transpiler
documentation talks about the transpiler plugins. All of the built-in plugins now have a decent amount of overview documentation, and the requirements and expectations for each stage of the preset pipelines is explained in more detail.This form of the documentation makes the distinction between "a compilation routine in general" and "Qiskit's specific choice of default pipeline" clearer, to avoid confusion for advanced users.
Much of the guide-level explanations of the different preset pipeline stages moved to https://docs.quantum.ibm.com some time ago, so this PR removes those, in favour of focussing on the actual API, and inserts links to learn more about the principles elsewhere.
The guide-level explanation of scheduling is left in-place for now, because the content on the other parts of the IBM documentation isn't as complete for that.
Details and comments
I've attempted to draw a good line between explaining what Qiskit actually does, so users know, and maintaining that we reserve the right to modify specifics of things (especially
default
plugins) between minor versions.This isn't a full rewrite of everything - I feel like we could probably do with revisiting the documentation of a lot of individual transpiler passes' classes - but I was writing my own plugin over the last month or so, and this is documentation I personally wanted to see.