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

Add partial draft of run-time parameters RFC #26

Closed
wants to merge 1 commit into from

Conversation

jakelishman
Copy link
Member

Apologies, there's quite a lot more I intended to write (and refine the current text) about further parts of the design and my progress, but I now need this to be up and available for others immediately.

I have pushed the branch move-instruction-parameters to my fork which contains what I have currently done. Roughly, this is:

  • added most of the backwards compatibility shim for Instruction.params
  • added a parameters field to CircuitInstruction, DAGOpNode and DAGDepNode (the last two might not be complete - I don't think I had fully finished updating DAGCircuit and DAGDependency)
  • updated the CircuitInstruction context class to insert a reference to themselves into contained Instruction instances
  • added a first pass at defining a "parameter specification" for Instruction instances
  • added a first (poor) pass at a new Instruction.decompose interface to replace Instruction.definition. What I've done isn't right at all - my failure here is what caused me to push this from Terra 0.21. The starts of the design in the RFC about defining "input parameters" for QuantumCircuit are the right way forwards here, and the weird attempts currently in the branch to handle Instruction.decompose and Instruction.definition should be completely redone.
  • made the initialisers of some gates accept zero parameters - in the new preferred form, the rz instruction will be initialised as RZGate(), and it's only when we add it to a circuit that we define its operands.

Certainly still to do:

  • the "parameter specification" probably needs tweaking (I would keep everything about this private for Terra 0.22, because we'll want to refine the system heavily for typed dynamic parameters)
  • all uses of Instruction.params (whether through circuits or DAGs) in Terra need updating to the new form.
  • QuantumCircuit needs to learn how to specify input parameters, so we can define the new interface for Instruction.decompose (or Instruction.definition).
  • The new Instruction.decompose / Instruction.definition method needs to be in place so ad-hoc no-subclass Instruction instances can be created and parameterised correctly (e.g. the return value from Instruction.inverse, etc).

Please don't take any of this RFC / any of the code I wrote in my branch on Terra as gospel - a lot of the interfaces doubtless need tweaking or rewriting.

@jakelishman
Copy link
Member Author

This is long since out-of-date, and anything left is obsoleted by the new Rust-space circuit-data work. I'll close this to avoid the clutter.

@jakelishman jakelishman closed this Aug 8, 2024
@jakelishman jakelishman deleted the runtime-parameters branch August 8, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC proposal New RFC is proposed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants