DVLab-NTU / qsyn

A C++-based growing software system for synthesizing, optimizing, and verifying quantum circuits
Apache License 2.0
166 stars 15 forks source link

Rewrite topological order issues in Duostra #39

Closed chinyi0523 closed 4 months ago

chinyi0523 commented 9 months ago

Duostra Mappers require ordered id gates

For some reason, after zx2qc sometimes the Duostra mapper will segfault as of v0.6.2. Here's the dofile, also available in tests/conversion/duostra/v0.6.2-bug.dof:

device read benchmark/topology/casablanca.layout
// This qcir won't fail
qcir qubit add 3
qcir gate add h 0
qcir gate add h 1 --prepend
qcir gate add cz 0 2 --prepend
qcir gate add cz 1 2 --prepend
qcir gate add h 0 --prepend
qcir gate add h 1 --prepend
qcir gate add h 2 --prepend
qcir gate add h 2 --prepend
qcir print -d
duostra -c
// This one will, even though these two are supposedly the same circuit???
qcir new
qcir qubit add 3
qcir gate add cx 2 1
qcir gate add cx 2 0
qc2zx
zxopt
zx2qc
qcir print -d
duostra -c

quit -f