-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow ActOnArgsContainer to support protocols.act_on #4371
Conversation
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.
Looks good. Few small nits. Also think we might be missing some return type annotations on the _act_on_fallback_
s in a lot of places. I would appreciate if @95-martin-orion took one final pass on this since he's a little more familiar than I am.
Only a couple of items to add on my part. |
Heads up: I'll be unavailable starting next week, so let me know if you'd like a re-review on this before then. |
It's ready, but not urgent. |
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
Fixes quantumlib#4368 Previously ActOnArgsContainer was "the top" in the act_on stack. However this caused CircuitOperations to entangle all qubits they contain. Now ActOnArgsContainer is just another act_on target, and CircuitOperaiton.act_on pushes its sub-operations through the act_on protocol into the ActOnArgsContainer, so the container never entangles the whole subcircuit. To note, this also represents something of a directional shift as we move toward classical flow control. Rather than the smarts living in the simulators, the smarts can live in the operations, such that the classical operations are given control of running their components. This approach isn't entirely new (stabilizer operations already use act_on to manage their own simulation within Clifford simulators), but specifically for classical control (of which subcircuits will be, themselves able to contain classical control operations), I anticipate this is the approach we will standardize on.
Fixes quantumlib#4368 Previously ActOnArgsContainer was "the top" in the act_on stack. However this caused CircuitOperations to entangle all qubits they contain. Now ActOnArgsContainer is just another act_on target, and CircuitOperaiton.act_on pushes its sub-operations through the act_on protocol into the ActOnArgsContainer, so the container never entangles the whole subcircuit. To note, this also represents something of a directional shift as we move toward classical flow control. Rather than the smarts living in the simulators, the smarts can live in the operations, such that the classical operations are given control of running their components. This approach isn't entirely new (stabilizer operations already use act_on to manage their own simulation within Clifford simulators), but specifically for classical control (of which subcircuits will be, themselves able to contain classical control operations), I anticipate this is the approach we will standardize on.
Fixes #4368
Previously ActOnArgsContainer was "the top" in the act_on stack. However this caused CircuitOperations to entangle all qubits they contain. Now ActOnArgsContainer is just another act_on target, and CircuitOperaiton.act_on pushes its sub-operations through the act_on protocol into the ActOnArgsContainer, so the container never entangles the whole subcircuit.
To note, this also represents something of a directional shift as we move toward classical flow control. Rather than the smarts living in the simulators, the smarts can live in the operations, such that the classical operations are given control of running their components. This approach isn't entirely new (stabilizer operations already use act_on to manage their own simulation within Clifford simulators), but specifically for classical control (of which subcircuits will be, themselves able to contain classical control operations), I anticipate this is the approach we will standardize on.