inQWIRE / SQIR

A Small Quantum Intermediate Representation
MIT License
79 stars 24 forks source link

VOQC got stuck when optimizing circuits #7

Closed 1tnguyen closed 4 years ago

1tnguyen commented 4 years ago

When using VOQC to optimize quantum circuits, there are several cases where VOQC got stuck (not complete after > 1 hour).

One such example is this qasm file https://github.com/CQCL/tket_benchmarking/blob/master/active/qasm_files/square_root_7.qasm

Thanks!

khieta commented 4 years ago

Thanks for reporting this. The issue is an inefficiency in our not_propagation routine (see Sec 4.3 of our draft). We hadn't observed this behavior yet because the benchmarks we considered use few, if any, X gates.

I'll start working on this now. I should be able to push a solution within a few days.

1tnguyen commented 4 years ago

Thank you for your quick response. I'm looking forward to checking out the fixed version.

khieta commented 4 years ago

I pushed the fix. Here's the output of running VOQC on the square root example on my machine:

$ cd VOQC
$ dune exec -- ./voqc.exe -i path/to/square_root_7.qasm -o out.qasm
Input file: path/to/square_root_7.qasm
Output file: out.qasm
Time to parse: 0.349963s
Original:    Total 7630, Rz 3336, Clifford 417, T 2919, H 985, X 220, CNOT 3089
Time to optimize: 0.233084s
Final:   Total 5122, Rz 1591, Clifford 468, T 1123, H 573, X 7, CNOT 2951
Time to write out: 0.002574s

Let us know if you spot any other issues!