-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add QuantumCircuit.noop
for instructionless qubit use
#13774
Conversation
This closes a usability gap between the low-level construction of control-flow ops and the builder interface. In the builder interface, there was previously no way to consider a qubit to be "used" by the scope without adding some corresponding instruction on it. It was possible to express this already by manually constructing the blocks. In general, this is not so useful for the control-flow operations that we already have present because the additional dependency is spurious and simply stymies some ability to perform optimisations. It is also a fair optimisation to remove the spurious data dependency in the transpiler. It becomes more useful with the upcoming `box`, however; this has additional semantics around its incident data dependencies.
One or more of the following people are relevant to this code:
|
Medium priority because it's part of the high-priority |
Pull Request Test Coverage Report for Build 13074080595Details
💛 - 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.
This PR is well-motivated and well-executed. My only (minor) question is whether we should use "future" examples in the documentation. @jakelishman. are you planning to add the QuantumCircuit.box
method for 2.0.0
?
with qc.box(): | ||
# This control-flow block will only use qubits 0 and 1. | ||
qc.cx(0, 1) |
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.
To make sure, we don't have the functionality qc.box()
is Qiskit yet, correct? So this code example would not be runnable, would this be a problem?
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.
Oh yeah sorry, I wrote the example speculatively, but it's written against the spec of Qiskit/RFCs#76. I can change it to if_test
for now if you like, but box
is the bigger motivation.
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, since box
will make it into 2.0 release, I am completely happy to keep this example as is.
Yeah, |
Summary
This closes a usability gap between the low-level construction of control-flow ops and the builder interface. In the builder interface, there was previously no way to consider a qubit to be "used" by the scope without adding some corresponding instruction on it. It was possible to express this already by manually constructing the blocks.
In general, this is not so useful for the control-flow operations that we already have present because the additional dependency is spurious and simply stymies some ability to perform optimisations. It is also a fair optimisation to remove the spurious data dependency in the transpiler. It becomes more useful with the upcoming
box
, however; this has additional semantics around its incident data dependencies.Details and comments
Close #13767.