Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
881a5e8
feat: :sparkles: add initial benchmark files and summaries
DRovara Nov 24, 2025
a7153b9
docs: :memo: add overarching README file for `benchmarks/structured`
DRovara Nov 24, 2025
8df167c
Update benchmarks/structured/ghz-linear/README.md
DRovara Nov 26, 2025
107746c
Update benchmarks/structured/ghz-star/README.md
DRovara Nov 26, 2025
307b79e
Update benchmarks/structured/grover/grover.qasm
DRovara Nov 26, 2025
272aa95
Update benchmarks/structured/iqft/README.md
DRovara Nov 26, 2025
40cf8c9
Update benchmarks/structured/multiplexer/multiplexer.qasm
DRovara Nov 26, 2025
05a8691
fix: :bug: add measurements to multiplexer benchmark program
DRovara Nov 26, 2025
2a83bbd
Update benchmarks/structured/README.md
DRovara Nov 26, 2025
947be8d
Update benchmarks/structured/README.md
DRovara Nov 26, 2025
10b20a2
feat: :sparkles: add measurements and classical bits to all benchmark…
DRovara Nov 26, 2025
e87700c
Update benchmarks/structured/iqft/iqft.qasm
DRovara Nov 26, 2025
863b176
Update benchmarks/structured/iqpe/iqpe.qasm
DRovara Nov 26, 2025
1bb19b0
Update benchmarks/structured/iqpe/iqpe.qasm
DRovara Nov 26, 2025
cde714f
Update benchmarks/structured/iqpe/README.md
DRovara Nov 26, 2025
f6ae6af
Update benchmarks/structured/qft/qft.qasm
DRovara Nov 26, 2025
5fa3664
Update benchmarks/structured/qpe/qpe.qasm
DRovara Nov 26, 2025
0cef473
Update benchmarks/structured/qpe/qpe.qasm
DRovara Nov 26, 2025
a5a0124
Merge branch 'feat/structured-benchmark-programs' of github.com:DRova…
DRovara Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
88 changes: 88 additions & 0 deletions benchmarks/structured/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Structured Benchmark Programs

This directory contains a collection of benchmark programs that use structured control-flow primitives.
These programs should be used as a set of challenges for quantum compilers to drive the development of more advanced compilation techniques.

## Benchmark Program Tracker

This section tracks the current programs of benchmark program implementation and indicates important features about the provided programs.

### Implemented Benchmark Programs

The following table lists the currently implemented benchmark programs and indicates the different formats the program is available in.

| Program | Jeff | OpenQASM 3 |
|------------------------------------------------------------------|------|---------------------------------------------------|
| [Quantum Teleportation](./teleportation/README.md) | ❌ | [✔️](./teleportation/teleportation.qasm) |
| [Grover's Search Algorithm](./grover/README.md) | ❌ | [✔️](./grover/grover.qasm) |
| [GHZ Sate Preparation (linear)](./ghz-linear/README.md) | ❌ | [✔️](./ghz-linear/ghz-linear.qasm) |
| [GHZ Sate Preparation (star)](./ghz-star/README.md) | ❌ | [✔️](./ghz-star/ghz-star.qasm) |
| [Quantum Fourier Transform (QFT)](./qft/README.md) | ❌ | [✔️](./qft/qft.qasm) |
| [Quantum Phase Estimation (QPE)](./qpe/README.md) | ❌ | [✔️](./qpe/qpe.qasm) |
| [Iterative Quantum Fourier Transform (iQFT)](./iqft/README.md) | ❌ | [✔️](./iqft/iqft.qasm) |
| [Iterative Quantum Phase Estimation (iQPE)](./iqpe/README.md) | ❌ | [✔️](./iqpe/iqpe.qasm) |
| [Quantum Multiplexer](./multiplexer/README.md) | ❌ | [✔️](./multiplexer/multiplexer.qasm) |

The following table lists the currently implemented benchmark programs together with the structured control-flow primitives they employ.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| Quantum Teleportation | ❌ | ❌ | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://doi.org/10.1103/PhysRevLett.70.1895) | ❌ | ❌ |
| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | 🟦 | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ✔️ | ❌ |
| GHZ State Preparation (linear) | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Wikipedia](https://en.wikipedia.org/wiki/GHZ_state) | ✔️ | ❌ |
| GHZ State Preparation (star) | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Wikipedia](https://en.wikipedia.org/wiki/GHZ_state) | ✔️ | ❌ |
| Quantum Fourier Transform (QFT) | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ❌ | ❌ | ❌ | [Nielsen and Chuang](https://doi.org/10.1017/CBO9780511976667) | ✔️ | ❌ |
| Quantum Phase Estimation (QPE) | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | [Nielsen and Chuang](https://doi.org/10.1017/CBO9780511976667) | ✔️ | ✔️ |
| Iterative Quantum Fourier Transform (iQFT) | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ❌ | ❌ | ✔️ | [Paper](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.76.3228) | ✔️ | ❌ |
| Iterative Quantum Phase Estimation (iQPE) | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | ❌ | ✔️ | [Paper](https://arxiv.org/abs/quant-ph/0610214) | ✔️ | ✔️ |
| Quantum Multiplexers | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0410066) | ✔️ | ✔️ |

#### Symbol Legend

| Symbol | Description |
|--------|-------------|
| ✔️ | Feature is required |
| ❌ | Feature is not used |
| 🟦 | Feature may be used depending on specific implementation |
| ❓ | Requires some further research |

#### Category Details

| Category | Description |
|----------|-------------|
| statically-bounded loops | Program uses loops with a constant number of repetitions. |
| dynamically-bounded loops | Loop bounds depend on value calculated at runtime. |
| dynamic qubit indexing | Gates are applied to qubits with non-constant indices (e.g. loop variable). |
| dynamic classical values | Gates use other classical values computed at runtime (e.g. rotation angles taken from arrays). |
| conditionals on originally classical values | Conditional blocks are used where the condition depends on values that were *not* measurement results. |
| conditionals on measurement results | Conditional blocks are used where the condition depends on values that depend on measurement results. |
| dynamic qubit allocation | Qubits are allocated at runtime (e.g. inside loop bodies). |
| qubit reuse | Existing qubits are reset and reused at runtime. |
| arbitrary-size | Instances can be defined generically and parameterized by input parameters to allow for different sizes at runtime. |
| composite | Program combines multiple structured control flow primitives. |

### Unimplemented Benchmark Programs

The following table tracks benchmark programs that have not been implemented yet and that may be implemented through future pull requests.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite
|-----|--------------|-------------------------|--------------------------|-----------------------|--------------|-------------------------|-------------|-----------|--------|----------|----------|
| Block Encoding | ❌ | ❌ | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ✔️ | ❌ |
| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ❌ | 🟦 | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ✔️ | ✔️ |
| QFT adder (quantum input, two registers) | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ❌ | ❌ | ❌ | [Draper](https://arxiv.org/abs/quant-ph/0008033) | ✔️ | ✔️ |
| QFT adder (classical input, single register) | ✔️ | ❌ | ✔️ | ✔️| 🟦 | ❌ | ❌ | ❌ | [Beauregard](https://arxiv.org/abs/quant-ph/0205095), Fig. 3 | ✔️ | ✔️ |
| Controlled multiplication modulo N | ✔️ | ✔️ | ✔️ | ✔️| 🟦 | ❌ | ❌ | ❌ | [Beauregard](https://arxiv.org/abs/quant-ph/0205095), Fig. 6 | ✔️ | ✔️ |
| Shor's Algorithm | ✔️ | 🟦 | ✔️ | ✔️ | ❌ | ❌ | ❌ | ✔️ | [Paper](https://arxiv.org/abs/quant-ph/9508027) | ✔️ | ✔️ |
| X-Ray Absorption Spectroscopy | ✔️ | ❌ | ✔️ | ❓ | ❓ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/2405.11015), [Tutorial](https://pennylane.ai/qml/demos/tutorial_xas) | ❌ | ✔️ |
| Repeat-Until-Success | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1311.1074) | ❌ | ❌ |
| Quantum Metropolis Sampling | ❌ | ✔️ | ✔️ | ❓ | ❓ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/0911.3635) | ❌ | ✔️ |
| ML-QAE | ❌ | ✔️ | ✔️ | ❓ | ❓ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1904.10246) | ❌ | ✔️ |
| Toffoli-heavy Circuits | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | ✔️ | [Paper](https://arxiv.org/abs/1904.01671) | ✔️ | ❌ |
| Parallelization with quantum fan-out | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ❌ | ✔️ | ❌| [Hoyer and Spalek](https://www.theoryofcomputing.org/articles/v001a005/v001a005.pdf), Figs. 4 and 5 | ✔️ | 🟦 |
| Magic State Distillation | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0403025) | ✔️ | ✔️ |
| Logical State Preparation | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Nielsen and Chuang](https://doi.org/10.1017/CBO9780511976667) | ✔️ | ✔️ |
| Syndrome Measurement and Correction | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Nielsen and Chuang](https://doi.org/10.1017/CBO9780511976667) | ✔️ | ✔️ |
| QAOA with Fixed Repetitions | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1411.4028) | ❌ | ❌ |
| VQE Ansatz with Fixed Repetitions | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | ❌ |
| VQE | ✔️ | ❌ | ❌ | ✔️ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | ✔️ |
| Measurement-based quantum computation | 🟦 | ❌ | 🟦 | ✔️ | ❌ | ✔️ | ❌ | 🟦 | [Wikipedia](https://en.wikipedia.org/wiki/One-way_quantum_computer) | ❌ | 🟦 |
7 changes: 7 additions & 0 deletions benchmarks/structured/ghz-linear/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ghz-linear

This benchmark program is an implementation of GHZ state preparation that sets up a fully entangled state by applying `CX` gates linearly to _nearest neighbor_ qubits through a `for` loop.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| GHZ State Preparation (linear) | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Wikipedia](https://en.wikipedia.org/wiki/GHZ_state) | ✔️ | ❌ |
14 changes: 14 additions & 0 deletions benchmarks/structured/ghz-linear/ghz-linear.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
OPENQASM 3.0;
include "qelib1.inc";

input int n;

qubit[n] q;
bit[n] c;

h q[0];
for int i in [1:n-1] {
cx q[i - 1], q[i];
}

c = measure q;
7 changes: 7 additions & 0 deletions benchmarks/structured/ghz-star/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ghz-star

This benchmark program is an implementation of GHZ state preparation that sets up a fully entangled state by applying `CX` gates in a star-like layout to `q[0]` and each other qubit through a `for` loop.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| GHZ State Preparation (star) | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Wikipedia](https://en.wikipedia.org/wiki/GHZ_state) | ✔️ | ❌ |
14 changes: 14 additions & 0 deletions benchmarks/structured/ghz-star/ghz-star.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
OPENQASM 3.0;
include "qelib1.inc";

input int n;

qubit[n] q;
bit[n] c;

h q[0];
for int i in [1:n-1] {
cx q[0], q[i];
}

c = measure q;
7 changes: 7 additions & 0 deletions benchmarks/structured/grover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# grover

This benchmark program is an implementation of Grover's algorithm searching for the state |111...1>.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | 🟦 | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ✔️ | ❌ |
27 changes: 27 additions & 0 deletions benchmarks/structured/grover/grover.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
OPENQASM 3.0;
include "qelib1.inc";

input int n;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we note somewhere that n must be greater than 1?

Copy link
Collaborator Author

@DRovara DRovara Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Alternatively, we could also make it so that the register q has size n and the program just uses n+1 qubits total to also include the ancilla qubit.

I've just noticed the same logic applies to a lot of other benchmark programs, too.
In that case, maybe we really should just indicate that it requires at least 2 qubits here.

What would you say is the best way to do that? Just a comment?


qubit[n-1] q;
qubit flag;
bit[n-1] c;

h q;
x flag;

int num_iterations = int(pi / 4 * sqrt(2**(n-1)));

for int i in [1:num_iterations] {
// oracle
ctrl(n-1) @ z q[0:n-1], flag;

// diffusion
h q;
x q;
ctrl(n-2) @ z q[0:n-2], q[n-1];
x q;
h q;
}

c = measure q;
7 changes: 7 additions & 0 deletions benchmarks/structured/iqft/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# iqft

This benchmark program is an implementation of Iterative Quantum Fourtier Transform (iQFT) with an arbitrary number of qubits.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| Iterative Quantum Fourier Transform (iQFT) | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ✔️ | ❌ | ✔️ | [Paper](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.76.3228) | ✔️ | ❌ |
17 changes: 17 additions & 0 deletions benchmarks/structured/iqft/iqft.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
OPENQASM 3.0;
include "qelib1.inc";

input int n;

qubit q;
bit[n] res;

for int i in [0:n-1] {
for int j in [0:i-1] {
if (res[n - 1 - j]) {
p(pi/2**(i-j)) q;
}
}
h q;
res[n - 1 - i] = measure q;
}
7 changes: 7 additions & 0 deletions benchmarks/structured/iqpe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# iqpe

This benchmark program is an implementation of Iterative Quantum Phase Estimation (iQPE) with an arbitrary number of qubits.

| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | dynamic classical values | conditionals on originally classical values | conditionals on measurement results | dynamic qubit allocation | qubit reuse | references | arbitrary-size | composite |
|-----------------------------------------------|--------------------------|---------------------------|------------------------|--------------------------|---------------------------------------------|-------------------------------------|--------------------------|-------------|----------------------------------------------------------------------------|----------------|-----------|
| Iterative Quantum Phase Estimation (iQPE) | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ✔️ | ❌ | ✔️ | [Paper](https://arxiv.org/abs/quant-ph/0610214) | ✔️ | ✔️ |
Loading