How should we decompose benchmark circuits? #39
-
I've made a number of discoveries in implementing our benchmarks in this notebook for #2: There is an issue with the way we count 2 qubit gates using Qiskit: raw_gates = qiskit_circuit.count_ops()
num_raw_gates = raw_gates.get("cz", 0) + raw_gates.get("cx", 0) + raw_gates.get("cy", 0) This works fine if a compiler is already compiling down to 2 qubit gates, but which is fine, we can add controlled rotations to the list of operations we check (although it would clearly be more convenient if Qiskit simply provided a utility to count all 2-qubit operations). But where I reach a genuine condundrum is where Qiskit's default pass compiles to abstract multi-qubit unitaries: Is it fair to compile the circuit down to 2 qubit gates beforerunning Benchmarking these compilers is a bit tricky bc I don't want to write a full set of compiler passes for Cirq, Qiskit, and TKET just to compare them, but I have to make some choices in order to get data. For instance, PyTKET has a pass called |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
@sonikaj I would appreciate your input here |
Beta Was this translation helpful? Give feedback.
-
Hi Jordan, try passing it a backend of the form: from qiskit.providers.fake_provider import GenericBackendV2 That should force it to compile to this gate set before it creates the final circuit. I think this is fair for comparison because most of the hardware backends will only accept this kind of gate set, and it's what we are targeting as well. |
Beta Was this translation helpful? Give feedback.
-
In the current version, I have decided to include both decomposed versions of the files (as indicated in the filename) as well as circuits without any gate decomposition. To count the gates on the non-decomposed circuits, I am using custom functions to count the number of multi-qubit gates (rather than just 2 qubit gates): d0483d2#diff-4885f6e829f132f4fff686b2f3e6b90269b606006bf318760a0a6a8d3f8afcba |
Beta Was this translation helpful? Give feedback.
-
I’d agree that for best comparison between toolchains the final target gate set should be fixed. Failing that, definitely do need to force it down to single and two qubit gates for now. For the medium term, we can have different benchmark tasks that measure performance against different hardware targets. For example neutral atoms and ion traps have some multi qubit gates and we’d want tasks that see if compilers are good at targeting them. |
Beta Was this translation helpful? Give feedback.
In the current version, I have decided to include both decomposed versions of the files (as indicated in the filename) as well as circuits without any gate decomposition. To count the gates on the non-decomposed circuits, I am using custom functions to count the number of multi-qubit gates (rather than just 2 qubit gates): d0483d2#diff-4885f6e829f132f4fff686b2f3e6b90269b606006bf318760a0a6a8d3f8afcba