From 50b198294d76c032f9fa3b0170ed560ce1e5ba00 Mon Sep 17 00:00:00 2001 From: chinyi0523 Date: Wed, 27 Dec 2023 00:11:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8A=20Add=20optimization=20flow=20test?= =?UTF-8?q?case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/optimization/dof/opt_lv0.dof | 14 +++++++++++++ tests/optimization/dof/opt_lv1.dof | 14 +++++++++++++ tests/optimization/dof/opt_lv2.dof | 14 +++++++++++++ tests/optimization/ref/opt_lv0.log | 32 ++++++++++++++++++++++++++++++ tests/optimization/ref/opt_lv1.log | 32 ++++++++++++++++++++++++++++++ tests/optimization/ref/opt_lv2.log | 32 ++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+) create mode 100644 tests/optimization/dof/opt_lv0.dof create mode 100644 tests/optimization/dof/opt_lv1.dof create mode 100644 tests/optimization/dof/opt_lv2.dof create mode 100644 tests/optimization/ref/opt_lv0.log create mode 100644 tests/optimization/ref/opt_lv1.log create mode 100644 tests/optimization/ref/opt_lv2.log diff --git a/tests/optimization/dof/opt_lv0.dof b/tests/optimization/dof/opt_lv0.dof new file mode 100644 index 00000000..bac7d4f5 --- /dev/null +++ b/tests/optimization/dof/opt_lv0.dof @@ -0,0 +1,14 @@ +extract config --optimize-level 0 +qcir read benchmark/SABRE/large/cm82a_208.qasm +convert qcir zx +zx optimize +convert zx qcir +qcir optimize +qcir print +convert qcir zx +zx adjoint +zx list +zx compose 0 +zx optimize +zx test --identity +quit -f \ No newline at end of file diff --git a/tests/optimization/dof/opt_lv1.dof b/tests/optimization/dof/opt_lv1.dof new file mode 100644 index 00000000..154aa9c2 --- /dev/null +++ b/tests/optimization/dof/opt_lv1.dof @@ -0,0 +1,14 @@ +extract config --optimize-level 1 +qcir read benchmark/SABRE/large/cm82a_208.qasm +convert qcir zx +zx optimize +convert zx qcir +qcir optimize +qcir print +convert qcir zx +zx adjoint +zx list +zx compose 0 +zx optimize +zx test --identity +quit -f \ No newline at end of file diff --git a/tests/optimization/dof/opt_lv2.dof b/tests/optimization/dof/opt_lv2.dof new file mode 100644 index 00000000..f6a381e3 --- /dev/null +++ b/tests/optimization/dof/opt_lv2.dof @@ -0,0 +1,14 @@ +extract config --optimize-level 2 +qcir read benchmark/SABRE/large/cm82a_208.qasm +convert qcir zx +zx optimize +convert zx qcir +qcir optimize +qcir print +convert qcir zx +zx adjoint +zx list +zx compose 0 +zx optimize +zx test --identity +quit -f diff --git a/tests/optimization/ref/opt_lv0.log b/tests/optimization/ref/opt_lv0.log new file mode 100644 index 00000000..059eefc4 --- /dev/null +++ b/tests/optimization/ref/opt_lv0.log @@ -0,0 +1,32 @@ +qsyn> extract config --optimize-level 0 + +qsyn> qcir read benchmark/SABRE/large/cm82a_208.qasm + +qsyn> convert qcir zx + +qsyn> zx optimize + +qsyn> convert zx qcir + +qsyn> qcir optimize + +qsyn> qcir print +QCir (16 qubits, 404 gates, 231 2-qubits gates, 122 T-gates, 516 depths) + +qsyn> convert qcir zx + +qsyn> zx adjoint + +qsyn> zx list + 0 cm82a_208 QC2ZX ➔ FR +★ 2 cm82a_208 QC2ZX ➔ FR ➔ ZX2QC ➔ Optimize ➔ QC2ZX + +qsyn> zx compose 0 + +qsyn> zx optimize + +qsyn> zx test --identity +The graph is an identity! + +qsyn> quit -f + diff --git a/tests/optimization/ref/opt_lv1.log b/tests/optimization/ref/opt_lv1.log new file mode 100644 index 00000000..47cbac35 --- /dev/null +++ b/tests/optimization/ref/opt_lv1.log @@ -0,0 +1,32 @@ +qsyn> extract config --optimize-level 1 + +qsyn> qcir read benchmark/SABRE/large/cm82a_208.qasm + +qsyn> convert qcir zx + +qsyn> zx optimize + +qsyn> convert zx qcir + +qsyn> qcir optimize + +qsyn> qcir print +QCir (16 qubits, 403 gates, 227 2-qubits gates, 122 T-gates, 509 depths) + +qsyn> convert qcir zx + +qsyn> zx adjoint + +qsyn> zx list + 0 cm82a_208 QC2ZX ➔ FR +★ 2 cm82a_208 QC2ZX ➔ FR ➔ ZX2QC ➔ Optimize ➔ QC2ZX + +qsyn> zx compose 0 + +qsyn> zx optimize + +qsyn> zx test --identity +The graph is an identity! + +qsyn> quit -f + diff --git a/tests/optimization/ref/opt_lv2.log b/tests/optimization/ref/opt_lv2.log new file mode 100644 index 00000000..3f40b0fa --- /dev/null +++ b/tests/optimization/ref/opt_lv2.log @@ -0,0 +1,32 @@ +qsyn> extract config --optimize-level 2 + +qsyn> qcir read benchmark/SABRE/large/cm82a_208.qasm + +qsyn> convert qcir zx + +qsyn> zx optimize + +qsyn> convert zx qcir + +qsyn> qcir optimize + +qsyn> qcir print +QCir (16 qubits, 384 gates, 217 2-qubits gates, 122 T-gates, 477 depths) + +qsyn> convert qcir zx + +qsyn> zx adjoint + +qsyn> zx list + 0 cm82a_208 QC2ZX ➔ FR +★ 2 cm82a_208 QC2ZX ➔ FR ➔ ZX2QC ➔ Optimize ➔ QC2ZX + +qsyn> zx compose 0 + +qsyn> zx optimize + +qsyn> zx test --identity +The graph is an identity! + +qsyn> quit -f +