QuTech-Delft / OpenQL

OpenQL: A Portable Quantum Programming Framework for Quantum Accelerators. https://dl.acm.org/doi/10.1145/3474222
https://openql.readthedocs.io
Other
99 stars 44 forks source link

Unreported change in syntax for compiler configuration file #391

Closed MiguelSMoreira closed 3 years ago

MiguelSMoreira commented 3 years ago

cc @wvlothuizen

It appears that the OpenQL configuration file was subject to a syntax change that wasn't effectively communicated.

Until today, when I updated OpenQL from version 0.8.0, I was able to define a gate decomposition using the following syntax: "gate_decomposition": { "cz q8 q10": ["barrier q8,q10,q11","sf_cz_sw q8","sf_cz_ne q10","sf_park q11","barrier q8,q10,q11"] };

As of today, attempting to compile using the same snippet leads to an error “Unsupported gate type: 20”. I understand this error arises from a failure to match to the correct cz decomposition, leading to the addition (by OpenQL) of a native CZ gate, which the OpenQL CC backend doesn't support/allow (explicitly stopping compilation with the aforementioned error).

Now, only the following syntax leads to proper identification of the decomposition, proving the change in syntax: "gate_decomposition": { "cz q8,q10": ["barrier q8,q10,q11","sf_cz_sw q8","sf_cz_ne q10","sf_park q11","barrier q8,q10,q11"] };

jvansomeren commented 3 years ago

I guess the problem is that default gates such as barrier were not allowed in decompositions Miguel or Wouter added a patch to allow that and that may have been removed when condex was added.

jvansomeren commented 3 years ago

So the issue is that you have to specify a "," between the specified arguments of a decomposition rule in a json file while you before your migration didn't have to. You found a work-around so this bug is not urgent anymore. Scanning the logs of the code imposing this "," requirement, I couldn't find where this was added. Sections 8.1.6 and 8.5.4 of the compiler documentation also specify by giving examples that you need to specify a "," in the configuration file. So I consider this bug solved.