In our QIR implementation, we have the need to run one-time initialization before any QIR API functions are called. At program exit, it is also useful for us to explicitly run any finalization activities (clean-up, print out, etc.). One specific use case that drives this initialization functionality is the need to indicate specifics about the backend being targeted. For example, our runtime implementation ultimately delegates to the qcor/xacc infrastructure, and therefore allows one to specify the quantum backend to target (IBM, Rigetti, simulators, etc), and input information for those specific backends (actual backend name, shots, simulation input, etc.). We package all of this type of input into a __quantum__rt_initialize(int, char**) function. The suggestion here is to indicate this in the specification, and ultimately let it be something that is optional, i.e. rt implementations can leverage it or not.
Considerations
This actually may be part of some larger specification update that details target QPU information provided at runtime. We may actually be able to package this as some sort of configuration file that is provided at some specification-noted location on the local host. If that is the case, then one may not need defined init/finalize type function calls, but can provide all input information as part of the configure file.
Affidavit (please fill out)
Please add ticks by placing a cross in the box:
[x] I have searched both open and closed suggestions and proposals on this site and believe this is not a duplicate.
[x] I believe that the spirit of this suggestion is aligned with the design principles and general vision for Q#.
Please tick all that apply:
[x] This is not a breaking change to the Q# language design
[x] I or my organization would be willing to help implement and/or test this
Suggestion
In our QIR implementation, we have the need to run one-time initialization before any QIR API functions are called. At program exit, it is also useful for us to explicitly run any finalization activities (clean-up, print out, etc.). One specific use case that drives this initialization functionality is the need to indicate specifics about the backend being targeted. For example, our runtime implementation ultimately delegates to the qcor/xacc infrastructure, and therefore allows one to specify the quantum backend to target (IBM, Rigetti, simulators, etc), and input information for those specific backends (actual backend name, shots, simulation input, etc.). We package all of this type of input into a
__quantum__rt_initialize(int, char**)
function. The suggestion here is to indicate this in the specification, and ultimately let it be something that is optional, i.e. rt implementations can leverage it or not.Considerations
This actually may be part of some larger specification update that details target QPU information provided at runtime. We may actually be able to package this as some sort of configuration file that is provided at some specification-noted location on the local host. If that is the case, then one may not need defined init/finalize type function calls, but can provide all input information as part of the configure file.
Affidavit (please fill out)
Please add ticks by placing a cross in the box:
Please tick all that apply: