-
Notifications
You must be signed in to change notification settings - Fork 47
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
Review qubit operand separation in strings in old style configuration files #444
Comments
Part of the problem is existing practice: some json files for cc and for diamond use a space as separator in the key in the gate_decomposition section and/or in the sub instructions.
Nowhere in the code is checked when reading a json file what is the case. Only some sanitation is done: removal of redundant spacing. Resulting keys are accepted and stored in the instruction_map. |
The documentation is quite clear that the operands should be a comma separated list:
The spaces as operand separator are probably a hangover of #214 (Jan 2019), and were already unsupported in https://github.com/DiCarloLab-Delft/OpenQL/blob/0.8.1.dev4/src/hardware_configuration.h#L157 (which is the version that now still runs on QI) For reference, the extra check should be built into:
|
…entries (containing " " instead of "," as separator) to subdir 'depr'. Also see QuTech-Delft/OpenQL#444
In old style configuration files in the instruction and decomposition sections keys (and decompositions) contain gates with operands. Those operands are identifiers such as q0, %0, etc. In those keys and decomposition sections, those operands are separated by a single comma optionally with spaces around them (that is the way that OpenQL accepts those rules).
But when those commas are omitted and only white space separates those operands, OpenQL cannot match those keys with actual gates with operands and/or when in decomposition rules operand separation no commas are used, the generated gates cannot be matched with instruction and decomposition rule keys. The end-effect is that particular gates are not decomposed and end up in the resulting qasm or at the entry of the code-generator. Examples have been seen of such behavior with cnot and swap gates (because these are the ones that occur often and need decomposition, also because swap decomposes to cnots).
Exactly which absence of commas is accepted and which result in non-matching has not been investigated yet.
What has been done, is a consistent replacement of sole white space by commas, which worked out well.
So the following are suspect in the decomposition section:
And in the instructions section:
What needs to be done:
The text was updated successfully, but these errors were encountered: