From fbaf45b57f2f16c1611ad19d46196908488d73be Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Sun, 2 Nov 2025 12:41:19 +0100 Subject: [PATCH 01/17] rfc: :memo: introduce RFC on structured benchmark programs --- .../0000-structured-benchmark-programs.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 rfcs/text/0000-structured-benchmark-programs.md diff --git a/rfcs/text/0000-structured-benchmark-programs.md b/rfcs/text/0000-structured-benchmark-programs.md new file mode 100644 index 0000000..f531a66 --- /dev/null +++ b/rfcs/text/0000-structured-benchmark-programs.md @@ -0,0 +1,157 @@ +- Feature Name: structured-benchmark-programs +- Start Date: 2025-10-31 +- RFC PR: [unitaryfoundation/jeff#0000](https://github.com/unitaryfoundation/jeff/pull/0000) + +# Summary +[summary]: #summary + +Quantum programs involving structured control flow operations such as `if` and `for` can only be represented in severely limited ways through existing quantum program formats. Qiskit does not allow dynamic qubit indexing, which is crucial for semantic `for` loops. Similarly, while OpenQASM 3 does not explicitly prohibit dynamic indexing, it leaves it open as an optional feature that many backends do not support. Jeff, on the other hand, has the ability to represent such programs, making it the ideal format for expressing a set of structured benchmark programs. These programs can then be used as a set of challenges for existing quantum compilers to drive the development of more advanced compilation techniques. + +# Motivation +[motivation]: #motivation + +Many programs can be greatly simplified through the use of structured control flow operations. +This includes simple loops for repeated operations, conditionals to implement classically controlled quantum operations in a natural way, and more complex loops and control flow structures that depend on measurement results and access qubits dynamically. + +However, a large number of existing quantum compiler toolchains still do not support some or even all of these features. +Proposing a set of such programs as benchmarks can not only help users evaluate the capabilities of different toolchains, but also serve as a motivation for compiler developers to implement these features. + +Furthermore, it can also increase the visibility of Jeff as a quantum program format that can express these advanced features, encouraging more users to adopt it for their quantum programming needs. + +# Guide-level explanation +[guide-level-explanation]: #guide-level-explanation + +A new directory, `benchmarks/structured` is introduced in the Jeff repository. +It provides a set of individual Jeff files that each represent a single structured benchmark program. + +In cases where the programs are adaptive in their size, it uses dynamic input parameters to keep the program implementation agnostic of the specifically desired size. +This may include examples such as arbitrarily sized GHZ state preparation, where the number of qubits is specified as an input parameter at runtime. +Similarly, programs that require classical input data such as rotation angles use input parameters to allow users to specify the data at runtime. +An example of this might be a VQA ansatz that is repeated several times using `for` loops. + +In contrast, some programs are provided with fixed sizes and parameters, either because they cannot easily be generalized or because they are intended as simpler test scenarios for basic compiler functionality. +Examples of this include simple Quantum Teleportation programs, or predefined instances of Grover's search algorithm. + +The modular directory structure allows future adaptations and extensions of the benchmark suite, either by adding other structured programs or by also including entirely new categories of benchmarks. + +While this feature may not directly impact the way many users interact with Jeff, it provides a valuable resource for evaluating and improving quantum compilers and test their compatibility with Jeff and advanced quantum programming features. + +# Implementation-level explanation +[implementation-level-explanation]: #implementation-level-explanation + +The following list outlines the proposed structured benchmark programs to be included in the `benchmarks/structured` directory, along with brief description, grouped by the way they utilize structured control flow: + +*Note: this list was created from previous discussions among community members and is open for further suggestions and modifications.* + +## Static Loops without Dynamic Qubit Indexing + +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, all operations are still statically indexed.* + +- *Grover's Search Algorithm*: Oracle and diffusion operations can be applied repeatedly using a fixed-size loop. (https://arxiv.org/abs/quant-ph/9605043) +- *VQE Ansatz with Fixed Repetitions*: A variational ansatz circuit that applies a set of parameterized gates in a loop with a predetermined number of repetitions. ([Peruzzo et al., 2014](https://arxiv.org/abs/1304.3061)) +- *QAOA with Fixed Repetitions*: A Quantum Approximate Optimization Algorithm circuit that applies problem and mixer Hamiltonians in a loop with a fixed number of layers. ([Farhi et al., 2014](https://arxiv.org/abs/1411.4028)) + +## Static Loops with Dynamic Qubit Indexing + +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, operations may be dynamically indexed (e.g. based on the loop parameter).* + +- *GHZ State Preparation*: A static loop is used to entangle all qubits with each other using `cx` gates where, at each loop index `i`, the `cx` gate is applied between qubit `0` and qubit `i`. ([Wikipedia on GHZ states](https://en.wikipedia.org/wiki/GHZ_state)) +- *Quantum Fourier Transform (QFT)*: Nested static loops are used to apply controlled phase rotations between qubits, where the control and target qubits are determined based on the loop index. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) +- *Quantum Phase Estimation (QPE)*: Static loops are used to apply controlled unitary operations and inverse QFT, with qubit indices determined by the loop parameters. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) +- *X-Ray Absorption Spectroscopy*: Simulation of X-Ray Absorption Spectroscopy is implemented using static loops based on [this paper](https://arxiv.org/abs/2405.11015) (https://pennylane.ai/qml/demos/tutorial_xas). + +## Dynamic Loops + +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do** depend on dynamic execution results, such as measurement outcomes. Operations may also be dynamically indexed.* + +- *Grover's Search with Weak Measurement*: Measurements on an ancilla qubit are utilized to determine whether to continue with another iteration of Grover's search or to stop as amplitude amplification has succeeded. ([Andrés-Martínez et al.](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta)) +- *Repeat-Until-Success*: Specific operations are applied repeatedly until a desired measurement outcome is achieved, indicating that a desired complex operation has been successfully implemented. +- *Quantum Metropolis Sampling*: [Temme et al., 2011](https://arxiv.org/abs/0911.3635) +- *ML-QAE*: [Suzuki et al., 2020](https://arxiv.org/abs/1904.10246) + +## Conditionals + +*This class of benchmark programs utilizes conditionals (such as `if`) to implement protocols or algorithms.* + +- *Quantum Teleportation*: Quantum teleportation is a canonical primitive for quantum communication and distributed computing. It utilizes conditionals based on measurement results to apply the appropriate correction operations. ([Bennett et al., 1993](https://doi.org/10.1103/PhysRevLett.70.1895)) +- *Block Encoding*: Block encoding embeds classical data or operators into quantum states. It underpins advanced algorithms like QSVT. It utilizes conditionals to apply different operations. ([Quantum Singular Value Transformation (QSVT)](https://arxiv.org/abs/1806.01838), [Low & Chuang, 2016](https://arxiv.org/abs/1606.02685)) + +## Mixed Control Flow + +*This class of benchmark programs combines loops and conditionals to implement more complex algorithms or protocols.* + +- *Quantum Multiplexers*: Quantum multiplexers apply different unitary operations based on the state of control qubits, effectively implementing conditionals in quantum circuits. ([Quantum multiplexers in circuit synthesis](https://arxiv.org/abs/quant-ph/0410066)) + +## Dynamic Qubit (Re-)Allocation + +*This class of benchmark programs allocates qubits dynamically during execution, based on runtime conditions or within loop bodies.* + +- *Iterative Quantum Fourier Transform (iQFT)*: Rather than allocating all qubits upfront, just a single qubit is allocated at the start of execution and then reset during each loop iteration of QFT. +- *Iterative Quantum Phase Estimation (iQPE)*: Similar to iQFT, iQPE allocates a single qubit (in addition to the phase qubit "psi") and reuses it across iterations to estimate the phase of a unitary operator. +- *Shor's Algorithm*: The primitives used in Shor's algorithm can similarly be implemented using dynamic qubit reallocation to minimize the total number of qubits required. + +## Loosely Coupled Hybrid Programs + +*Variational and hybrid algorithms naturally combine quantum circuits with classical optimization loops. They are loosely coupled because the quantum and classical parts interact only at well-defined synchronization points.* + +- *VQE*: A variational quantum eigensolver algorithm that uses a classical optimizer to minimize the energy of a parameterized quantum circuit which implements several iterations of some ansatz. ([Peruzzo et al., 2014](https://arxiv.org/abs/1304.3061)) +- *QAOA*: A quantum approximate optimization algorithm that uses a classical optimizer to find optimal parameters for a parameterized quantum circuit. It iteratively applies a "problem" and "mixer" operator using loop structures. ([Farhi et al., 2014](https://arxiv.org/abs/1411.4028)) + +## Fault-Tolerant State Preparation and Error Correction + +*Quantum Error Correction (QEC) is one of the most important applications of structured control flow in quantum computing. These benchmark programs implement QEC protocols that involve structured operations at any point in the program.* + +- *Magic State Distillation*: Magic state distillation protocols utilize loops and conditionals to iteratively improve the fidelity of magic states, which are essential for fault-tolerant quantum computing. ([Bravyi & Kitaev, 2005](https://arxiv.org/abs/quant-ph/0403025)) + +--- + +Each of the benchmark programs listed above should be implemented individually to achieve a comprehensive suite that covers a wide range of structured control flow scenarios. + +# Drawbacks +[drawbacks]: #drawbacks + +There are several potential drawbacks to consider with this proposal: + +- Maintenance Overhead: The addition of a new benchmark suite requires ongoing maintenance to ensure that the benchmarks remain relevant and up-to-date with the latest advancements in quantum computing and compiler technologies. +- Complexity: Introducing structured benchmarks may increase the complexity of the Jeff repository, potentially making it more challenging for new users to navigate and understand the available resources. +- Limited Adoption: If the benchmarks are not widely adopted by the quantum computing community, their impact may be limited, reducing the incentive for compiler developers to implement support for structured control flow. + +# Rationale and alternatives +[rationale-and-alternatives]: #rationale-and-alternatives + +Potential alternatives include: +- *Implementing structured benchmarks using OpenQASM 3*: While it is possible to represent all desired structured program features in OpenQASM 3, many of these features are only optional and not widely supported by existing backends. Furthermore, using such a representation runs the risk of larger specification changes in the future that could break compatibility. +- *Using more involved quantum programming frameworks like PennyLane*: While frameworks like PennyLane can express structured quantum programs, they often come with additional abstractions and dependencies that are not easily translatable to arbitrary other representations. As the goal of Jeff is to be a widely compatible exchange format, it mitigates this risk by allowing easier compatibility with different representations. +- *Not implementing structured benchmarks at all*: Sooner or later, the quantum computing community will need to address the challenges of structured control flow in quantum programs. By not providing a benchmark suite, we risk slowing down the progress in this area and missing out on opportunities to drive compiler development. + +As the reasoning above shows, the proposed design of structured benchmark programs in Jeff is the most effective way to address the need for evaluating and improving quantum compilers' support for advanced control flow features. + +# Prior art +[prior-art]: #prior-art + +A variety of benchmark suites exist already in the quantum computing community, such as: +- [UCC Bench](https://github.com/unitaryfoundation/ucc-bench): A command-line utility designed to benchmark and compare the performance of various quantum compilers, with a particular focus on the ucc compiler. +- [MQT Bench](https://github.com/munich-quantum-toolkit/bench): A collection of benchmark circuits in qiskit format to evaluate quantum software tools. +- [metriq-gym](https://github.com/unitaryfoundation/metriq-gym): A framework for implementing and running standard quantum benchmarks. + +While many of these benchmark suites are widely used and provide valuable insights into quantum compiler performance, they often lack support for structured control flow features such as dynamic loops and conditionals. + +To the best of our knowledge, there is currently no widely adopted benchmark suite that specifically targets the evaluation of quantum compilers' support for structured control flow operations, although the topic has been discussed in various community gatherings and conferences. + +# Unresolved questions +[unresolved-questions]: #unresolved-questions + +- Are there any additional structured benchmark programs that should be included in the initial release? +- How can we best facilitate the adoption of these benchmarks by the quantum computing community? +- Does Jeff already support all necessary features to accurately represent the proposed structured benchmark programs? + +# Future possibilities +[future-possibilities]: #future-possibilities + +As the field of quantum computing continues to evolve, there are several potential future directions for the structured benchmark programs: + +- Addition of further benchmark programs: As structured control flow becomes more prevalent in quantum programming, new algorithms may emerge that utilize these features in novel ways. The benchmark suite can be expanded to include these new algorithms, providing a more comprehensive evaluation of compiler capabilities. +- Addition of further types of structured control flow: Additional benchmark programs may be defined that include further features from classical programming, such as `switch` statements, more complex data structures, exception handling, concurrency, or even function calls and recursion. These features could further challenge quantum compilers and drive advancements in their capabilities. + +For the time being, it should already be more than sufficient to cover the types of programs listed above. +The goal should be, first and foremost, to quickly and efficiently set up a solid foundation for the development of compilers with structured control flow support. From 0111dac3fbb46de2b65ab4aa96528d382791d940 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Sun, 2 Nov 2025 12:58:37 +0100 Subject: [PATCH 02/17] docs: :memo: update RFC id to 0032 --- ...chmark-programs.md => 0032-structured-benchmark-programs.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename rfcs/text/{0000-structured-benchmark-programs.md => 0032-structured-benchmark-programs.md} (99%) diff --git a/rfcs/text/0000-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md similarity index 99% rename from rfcs/text/0000-structured-benchmark-programs.md rename to rfcs/text/0032-structured-benchmark-programs.md index f531a66..5ebf27d 100644 --- a/rfcs/text/0000-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -1,6 +1,6 @@ - Feature Name: structured-benchmark-programs - Start Date: 2025-10-31 -- RFC PR: [unitaryfoundation/jeff#0000](https://github.com/unitaryfoundation/jeff/pull/0000) +- RFC PR: [unitaryfoundation/jeff#0032](https://github.com/unitaryfoundation/jeff/pull/0032) # Summary [summary]: #summary From 6406a2ca1f694e5bfb0a64b606fc22ff70d8e798 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Mon, 3 Nov 2025 10:48:01 +0100 Subject: [PATCH 03/17] docs: :memo: add `NOTE` environment for NOTE in rfc readme --- rfcs/text/0032-structured-benchmark-programs.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 5ebf27d..b72fe1d 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -41,7 +41,8 @@ While this feature may not directly impact the way many users interact with Jeff The following list outlines the proposed structured benchmark programs to be included in the `benchmarks/structured` directory, along with brief description, grouped by the way they utilize structured control flow: -*Note: this list was created from previous discussions among community members and is open for further suggestions and modifications.* +[!NOTE] +This list was created from previous discussions among community members and is open for further suggestions and modifications.* ## Static Loops without Dynamic Qubit Indexing From c7ada5c167f765db55c5bbb801b100bc0957fdcc Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Mon, 3 Nov 2025 10:53:57 +0100 Subject: [PATCH 04/17] docs: :memo: add new algorithm classes --- rfcs/text/0032-structured-benchmark-programs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index b72fe1d..d18a73b 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -90,6 +90,7 @@ This list was created from previous discussions among community members and is o - *Iterative Quantum Fourier Transform (iQFT)*: Rather than allocating all qubits upfront, just a single qubit is allocated at the start of execution and then reset during each loop iteration of QFT. - *Iterative Quantum Phase Estimation (iQPE)*: Similar to iQFT, iQPE allocates a single qubit (in addition to the phase qubit "psi") and reuses it across iterations to estimate the phase of a unitary operator. - *Shor's Algorithm*: The primitives used in Shor's algorithm can similarly be implemented using dynamic qubit reallocation to minimize the total number of qubits required. +- *Toffoli-heavy Circuits*: Toffoli gates in quantum circuits can be implemented more efficiently using ancilla qubits. Circuits using a larger number of Toffoli gates, such as many arithmetic circuits, can benefit from dynamic qubit allocation to allocate and deallocate ancilla qubits repeatedly inside loop bodies. ## Loosely Coupled Hybrid Programs @@ -103,6 +104,8 @@ This list was created from previous discussions among community members and is o *Quantum Error Correction (QEC) is one of the most important applications of structured control flow in quantum computing. These benchmark programs implement QEC protocols that involve structured operations at any point in the program.* - *Magic State Distillation*: Magic state distillation protocols utilize loops and conditionals to iteratively improve the fidelity of magic states, which are essential for fault-tolerant quantum computing. ([Bravyi & Kitaev, 2005](https://arxiv.org/abs/quant-ph/0403025)) +- *Logical Sate Preparation*: Preparing logical qubits in specific states using QEC codes involves structured operations to ensure fault tolerance. +- *Syndrome Measurement and Correction*: QEC protocols involve measuring error syndromes and applying corrections based on the measurement outcomes, utilizing conditionals to determine the appropriate corrective actions. --- @@ -143,6 +146,7 @@ To the best of our knowledge, there is currently no widely adopted benchmark sui [unresolved-questions]: #unresolved-questions - Are there any additional structured benchmark programs that should be included in the initial release? +- How do we define and/or produce these programs? What development "front end" should be used? - How can we best facilitate the adoption of these benchmarks by the quantum computing community? - Does Jeff already support all necessary features to accurately represent the proposed structured benchmark programs? From b06732b2823c821e65c047ca95c86120ef9d9882 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Mon, 3 Nov 2025 18:30:10 +0100 Subject: [PATCH 05/17] docs: :memo: add overview table with program types and features to rfc description --- .../0032-structured-benchmark-programs.md | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index d18a73b..0fdfb75 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -39,11 +39,41 @@ While this feature may not directly impact the way many users interact with Jeff # Implementation-level explanation [implementation-level-explanation]: #implementation-level-explanation -The following list outlines the proposed structured benchmark programs to be included in the `benchmarks/structured` directory, along with brief description, grouped by the way they utilize structured control flow: +This chapter outlines the proposed structured benchmark programs to be included in the `benchmarks/structured` directory. +In the table below, for each program type, the required structured control flow features are listed, as well as references to relevant literature or resources for further reading. +Programs for which "*arbitrary size*" is marked can be defined generically and parameterized by input parameters to allow for different sizes at runtime. +Further details on each program type are provided in the sections that follow the table. [!NOTE] This list was created from previous discussions among community members and is open for further suggestions and modifications.* +| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | conditionals | dynamic qubit allocation | qubit reuse | references | arbitrary-size | +-----|--------------|-------------------------|--------------------------|-----------------------|--------------|-------------------------|-------------|-----------| +| Quantum Teleportation | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://doi.org/10.1103/PhysRevLett.70.1895) | ❌ | +| Block Encoding | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ❌ | +| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ❌ | +| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ❌ | +| GHZ State Preparation | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | [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) | ✔️ | +| 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) | ❌ | +| Quantum Multiplexers | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0410066) | ✔️ | +| Toffoli-heavy Circuits | ✔️ | ❌ | ✔️ | ❌ | ✔️ | ✔️ | [Paper](https://arxiv.org/abs/1904.01671) | ✔️ | +| 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) | ✔️ | +| VQE Ansatz with Fixed Repetitions | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | +| VQE | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | +| QAOA with Fixed Repetitions | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1411.4028) | ❌ | + +The following sections provide more details on each program type. + ## Static Loops without Dynamic Qubit Indexing *This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, all operations are still statically indexed.* From 2d398ee6d80f5dcefbc59c7f7019f6717b2e051e Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Tue, 4 Nov 2025 11:53:11 +0100 Subject: [PATCH 06/17] docs: :memo: fix note syntax in RFC document --- rfcs/text/0032-structured-benchmark-programs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 0fdfb75..35c16d4 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -44,8 +44,8 @@ In the table below, for each program type, the required structured control flow Programs for which "*arbitrary size*" is marked can be defined generically and parameterized by input parameters to allow for different sizes at runtime. Further details on each program type are provided in the sections that follow the table. -[!NOTE] -This list was created from previous discussions among community members and is open for further suggestions and modifications.* +> [!NOTE] +> This list was created from previous discussions among community members and is open for further suggestions and modifications. | Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | conditionals | dynamic qubit allocation | qubit reuse | references | arbitrary-size | -----|--------------|-------------------------|--------------------------|-----------------------|--------------|-------------------------|-------------|-----------| From dc46b6aced38063e5a7f9d22def76e2a41a31dfc Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Tue, 4 Nov 2025 12:37:48 +0100 Subject: [PATCH 07/17] docs: :memo: incorporate some of the feedback on the RFC --- rfcs/text/0032-structured-benchmark-programs.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 35c16d4..a9153fd 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -13,8 +13,10 @@ Quantum programs involving structured control flow operations such as `if` and ` Many programs can be greatly simplified through the use of structured control flow operations. This includes simple loops for repeated operations, conditionals to implement classically controlled quantum operations in a natural way, and more complex loops and control flow structures that depend on measurement results and access qubits dynamically. +Furthermore, some programs may even *require* structured program representation (e.g., those where loop iterations are dynamic and dependent on measurement values). In these cases, unrolling the program into a flat sequence of gates is either impossible or leads to an exponential blow-up in program size. + However, a large number of existing quantum compiler toolchains still do not support some or even all of these features. -Proposing a set of such programs as benchmarks can not only help users evaluate the capabilities of different toolchains, but also serve as a motivation for compiler developers to implement these features. +Proposing a set of such programs as benchmarks can not only help users evaluate the capabilities of different toolchains, but also serve as a motivation for compiler developers to implement features such as the compilation of such programs *without unrolling* the program structure, and even *rethink the use of circuits* as the default program representation for quantum compilation - can they do better and result in more optimized programs by taking into account the additional information available from the structure? Furthermore, it can also increase the visibility of Jeff as a quantum program format that can express these advanced features, encouraging more users to adopt it for their quantum programming needs. @@ -50,9 +52,9 @@ Further details on each program type are provided in the sections that follow th | Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | conditionals | dynamic qubit allocation | qubit reuse | references | arbitrary-size | -----|--------------|-------------------------|--------------------------|-----------------------|--------------|-------------------------|-------------|-----------| | Quantum Teleportation | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://doi.org/10.1103/PhysRevLett.70.1895) | ❌ | -| Block Encoding | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ❌ | -| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ❌ | -| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ❌ | +| Block Encoding | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ✔️ | +| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ✔️ | +| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ✔️ | | GHZ State Preparation | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | [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) | ✔️ | @@ -86,7 +88,7 @@ The following sections provide more details on each program type. *This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, operations may be dynamically indexed (e.g. based on the loop parameter).* -- *GHZ State Preparation*: A static loop is used to entangle all qubits with each other using `cx` gates where, at each loop index `i`, the `cx` gate is applied between qubit `0` and qubit `i`. ([Wikipedia on GHZ states](https://en.wikipedia.org/wiki/GHZ_state)) +- *GHZ State Preparation*: A static loop is used to entangle all qubits with each other using `cx` gates where, at each loop index `i`, the `cx` gate is applied between qubit `0` and qubit `i`. Alternatively, qubits `i` and `i + 1` could also be entangled iteratively. A benchmark program for both variants might be helpful. ([Wikipedia on GHZ states](https://en.wikipedia.org/wiki/GHZ_state)) - *Quantum Fourier Transform (QFT)*: Nested static loops are used to apply controlled phase rotations between qubits, where the control and target qubits are determined based on the loop index. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) - *Quantum Phase Estimation (QPE)*: Static loops are used to apply controlled unitary operations and inverse QFT, with qubit indices determined by the loop parameters. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) - *X-Ray Absorption Spectroscopy*: Simulation of X-Ray Absorption Spectroscopy is implemented using static loops based on [this paper](https://arxiv.org/abs/2405.11015) (https://pennylane.ai/qml/demos/tutorial_xas). @@ -149,6 +151,7 @@ There are several potential drawbacks to consider with this proposal: - Maintenance Overhead: The addition of a new benchmark suite requires ongoing maintenance to ensure that the benchmarks remain relevant and up-to-date with the latest advancements in quantum computing and compiler technologies. - Complexity: Introducing structured benchmarks may increase the complexity of the Jeff repository, potentially making it more challenging for new users to navigate and understand the available resources. - Limited Adoption: If the benchmarks are not widely adopted by the quantum computing community, their impact may be limited, reducing the incentive for compiler developers to implement support for structured control flow. +- Comparisons are not simple: For users, it might not be stratighforward to know what to compare against when compiling these structured programs. For a full, fair evaluation, a meaningful baseline needs to be established and a more precise methodology for comparison is likely necessary. # Rationale and alternatives [rationale-and-alternatives]: #rationale-and-alternatives @@ -179,6 +182,7 @@ To the best of our knowledge, there is currently no widely adopted benchmark sui - How do we define and/or produce these programs? What development "front end" should be used? - How can we best facilitate the adoption of these benchmarks by the quantum computing community? - Does Jeff already support all necessary features to accurately represent the proposed structured benchmark programs? +- In setting a compilation challenge, what is the benchmark for compilation of these *unrolled* programs (where possible) that a user should compare against? # Future possibilities [future-possibilities]: #future-possibilities From 026a7f1d9b089c41e6bc540706d301a1e4edeaa1 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Tue, 4 Nov 2025 15:01:11 +0100 Subject: [PATCH 08/17] docs: :memo: incorporate further RFC review comments --- .../0032-structured-benchmark-programs.md | 77 +++++++++++++------ 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index a9153fd..8f53d37 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -7,6 +7,11 @@ Quantum programs involving structured control flow operations such as `if` and `for` can only be represented in severely limited ways through existing quantum program formats. Qiskit does not allow dynamic qubit indexing, which is crucial for semantic `for` loops. Similarly, while OpenQASM 3 does not explicitly prohibit dynamic indexing, it leaves it open as an optional feature that many backends do not support. Jeff, on the other hand, has the ability to represent such programs, making it the ideal format for expressing a set of structured benchmark programs. These programs can then be used as a set of challenges for existing quantum compilers to drive the development of more advanced compilation techniques. +This RFC proposes to: +- gather and provide a list of important patterns and algorithms that contain structure and/or dynamism +- create a collection of artifacts representing these patterns/algorithms using various existing software program representations, and determine ecosystem support. +- set a challenge to the broader community to start thinking about compiling such programs efficiently by adding support and optimizations for them to their toolchains. + # Motivation [motivation]: #motivation @@ -43,36 +48,58 @@ While this feature may not directly impact the way many users interact with Jeff This chapter outlines the proposed structured benchmark programs to be included in the `benchmarks/structured` directory. In the table below, for each program type, the required structured control flow features are listed, as well as references to relevant literature or resources for further reading. -Programs for which "*arbitrary size*" is marked can be defined generically and parameterized by input parameters to allow for different sizes at runtime. Further details on each program type are provided in the sections that follow the table. > [!NOTE] > This list was created from previous discussions among community members and is open for further suggestions and modifications. -| Program Type | statically-bounded loops | dynamically-bounded loops | dynamic qubit indexing | conditionals | dynamic qubit allocation | qubit reuse | references | arbitrary-size | ------|--------------|-------------------------|--------------------------|-----------------------|--------------|-------------------------|-------------|-----------| -| Quantum Teleportation | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://doi.org/10.1103/PhysRevLett.70.1895) | ❌ | -| Block Encoding | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ✔️ | -| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ✔️ | -| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ✔️ | -| GHZ State Preparation | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | [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) | ✔️ | -| 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) | ❌ | -| Quantum Multiplexers | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0410066) | ✔️ | -| Toffoli-heavy Circuits | ✔️ | ❌ | ✔️ | ❌ | ✔️ | ✔️ | [Paper](https://arxiv.org/abs/1904.01671) | ✔️ | -| 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) | ✔️ | -| VQE Ansatz with Fixed Repetitions | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | -| VQE | ✔️ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1304.3061) | ✔️ | -| QAOA with Fixed Repetitions | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1411.4028) | ❌ | +| 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) | ❌ | ❌ | +| Block Encoding | ❌ | ❌ | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1606.02685), [Paper](https://arxiv.org/abs/1806.01838) | ✔️ | ❌ | +| Grover's Search Algorithm | ✔️ | ❌ | ❌ | ❌ | 🟦 | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/9605043) | ✔️ | ❌ | +| Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ❌ | 🟦 | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ✔️ | ✔️ | +| GHZ State Preparation | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [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) | ✔️ | ✔️ | +| 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) | ❌ | ✔️ | +| Quantum Multiplexers | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0410066) | ✔️ | ✔️ | +| Toffoli-heavy Circuits | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ✔️ | ✔️ | [Paper](https://arxiv.org/abs/1904.01671) | ✔️ | ❌ | +| 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) | ✔️ | ✔️ | + +### Symbol Legend + +| Symbol | Description | +|--------|-------------| +| ✔️ | Feature is required | +| ❌ | Feature is not used | +| 🟦 | Feature may be used depending on specific implementation | + +### 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. | The following sections provide more details on each program type. From ec73c59683c6755776fae9ba11a28bd65df253c3 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Tue, 4 Nov 2025 15:19:09 +0100 Subject: [PATCH 09/17] docs: :memo: add description of "?" symbol to legend --- rfcs/text/0032-structured-benchmark-programs.md | 1 + 1 file changed, 1 insertion(+) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 8f53d37..e111414 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -85,6 +85,7 @@ Further details on each program type are provided in the sections that follow th | ✔️ | Feature is required | | ❌ | Feature is not used | | 🟦 | Feature may be used depending on specific implementation | +| ❓ | Requires some further research | ### Category Details From fcbd5d69626a3e8aed6d55e0b6aca602629f58e2 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 6 Nov 2025 16:20:27 +0100 Subject: [PATCH 10/17] docs: :memo: mark shor as arbitrary-size and and potentially dynamically-bounded loops --- rfcs/text/0032-structured-benchmark-programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index e111414..1ad2e5e 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -64,7 +64,7 @@ Further details on each program type are provided in the sections that follow th | 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) | ✔️ | ✔️ | -| Shor's Algorithm | ✔️ | ❌ | ✔️ | ✔️ | ❌ | ❌ | ❌ | ✔️ | [Paper](https://arxiv.org/abs/quant-ph/9508027) | ❌ | ✔️ | +| 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) | ❌ | ✔️ | From c695843f60f2441cbbd83a803b1aa13509f8016e Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 6 Nov 2025 16:35:15 +0100 Subject: [PATCH 11/17] docs: :memo: further updates to RFC based on discussion --- rfcs/text/0032-structured-benchmark-programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 1ad2e5e..5561e21 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -5,7 +5,7 @@ # Summary [summary]: #summary -Quantum programs involving structured control flow operations such as `if` and `for` can only be represented in severely limited ways through existing quantum program formats. Qiskit does not allow dynamic qubit indexing, which is crucial for semantic `for` loops. Similarly, while OpenQASM 3 does not explicitly prohibit dynamic indexing, it leaves it open as an optional feature that many backends do not support. Jeff, on the other hand, has the ability to represent such programs, making it the ideal format for expressing a set of structured benchmark programs. These programs can then be used as a set of challenges for existing quantum compilers to drive the development of more advanced compilation techniques. +Quantum programs involving structured control flow operations such as `if` and `for` can only be represented in severely limited ways through existing quantum program formats. Qiskit does not allow dynamic qubit indexing, which is crucial for semantic `for` loops. Similarly, while OpenQASM 3 does not explicitly prohibit dynamic indexing, it leaves it open as an optional feature that many backends do not support. Jeff, on the other hand, has the ability to represent such programs, making it the ideal format for expressing a set of structured benchmark programs. These programs can then be used as a set of challenges for quantum compilers to drive the development of more advanced compilation techniques. This RFC proposes to: - gather and provide a list of important patterns and algorithms that contain structure and/or dynamism From 3ebde9e0bc30b3573cdd94582e6c3653ba208864 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 6 Nov 2025 16:40:30 +0100 Subject: [PATCH 12/17] docs: :memo: potentially clear up terminology for static/dynamic loops --- rfcs/text/0032-structured-benchmark-programs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 5561e21..c4ae7c2 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -104,26 +104,26 @@ Further details on each program type are provided in the sections that follow th The following sections provide more details on each program type. -## Static Loops without Dynamic Qubit Indexing +## Statically Bounded Loops without Dynamic Qubit Indexing -*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, all operations are still statically indexed.* +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on values computed at runtime. Inside the loop bodies, all operations are still statically indexed.* - *Grover's Search Algorithm*: Oracle and diffusion operations can be applied repeatedly using a fixed-size loop. (https://arxiv.org/abs/quant-ph/9605043) - *VQE Ansatz with Fixed Repetitions*: A variational ansatz circuit that applies a set of parameterized gates in a loop with a predetermined number of repetitions. ([Peruzzo et al., 2014](https://arxiv.org/abs/1304.3061)) - *QAOA with Fixed Repetitions*: A Quantum Approximate Optimization Algorithm circuit that applies problem and mixer Hamiltonians in a loop with a fixed number of layers. ([Farhi et al., 2014](https://arxiv.org/abs/1411.4028)) -## Static Loops with Dynamic Qubit Indexing +## Statically Bounded Loops with Dynamic Qubit Indexing -*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on dynamic execution results. Inside the loop bodies, operations may be dynamically indexed (e.g. based on the loop parameter).* +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do not** depend on values computed at runtime. Inside the loop bodies, operations may be dynamically indexed (e.g. based on the loop parameter).* - *GHZ State Preparation*: A static loop is used to entangle all qubits with each other using `cx` gates where, at each loop index `i`, the `cx` gate is applied between qubit `0` and qubit `i`. Alternatively, qubits `i` and `i + 1` could also be entangled iteratively. A benchmark program for both variants might be helpful. ([Wikipedia on GHZ states](https://en.wikipedia.org/wiki/GHZ_state)) - *Quantum Fourier Transform (QFT)*: Nested static loops are used to apply controlled phase rotations between qubits, where the control and target qubits are determined based on the loop index. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) - *Quantum Phase Estimation (QPE)*: Static loops are used to apply controlled unitary operations and inverse QFT, with qubit indices determined by the loop parameters. ([Nielsen and Chuang, 2010](https://doi.org/10.1017/CBO9780511976667)) - *X-Ray Absorption Spectroscopy*: Simulation of X-Ray Absorption Spectroscopy is implemented using static loops based on [this paper](https://arxiv.org/abs/2405.11015) (https://pennylane.ai/qml/demos/tutorial_xas). -## Dynamic Loops +## Dynamically Bounded Loops -*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do** depend on dynamic execution results, such as measurement outcomes. Operations may also be dynamically indexed.* +*This class of benchmark programs utilizes loops (such as `for` and `while`) that **do** depend on values computed at runtime, such as measurement outcomes. Operations may also be dynamically indexed.* - *Grover's Search with Weak Measurement*: Measurements on an ancilla qubit are utilized to determine whether to continue with another iteration of Grover's search or to stop as amplitude amplification has succeeded. ([Andrés-Martínez et al.](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta)) - *Repeat-Until-Success*: Specific operations are applied repeatedly until a desired measurement outcome is achieved, indicating that a desired complex operation has been successfully implemented. From 0756fca9db2dbfaffec421ff4ebfe13d9a7c9bc0 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 13 Nov 2025 13:44:38 +0100 Subject: [PATCH 13/17] docs: :memo: add information from recent discussion to "Guide-level explanation" --- .../0032-structured-benchmark-programs.md | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index c4ae7c2..cb94641 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -28,10 +28,20 @@ Furthermore, it can also increase the visibility of Jeff as a quantum program fo # Guide-level explanation [guide-level-explanation]: #guide-level-explanation +## File Locations and Formats + A new directory, `benchmarks/structured` is introduced in the Jeff repository. -It provides a set of individual Jeff files that each represent a single structured benchmark program. +It contains a set of sub-directories for each individual structured benchmark program. +These sub-directories may contain implementations of the respective program in different *intermediate* representations, such as Jeff or OpenQASM 3. + +Implementations in higher-level frameworks such as Qiskit or PennyLane may also be included, but they should be actively divided specifically into the directory `benchmarks/_recipes/structured/` to indicate that they are not to be used as generalized benchmark formats, but rather as "recipes" for generating them. +In this case, reprodubility of the Jeff programs generated from them has to be ensured, e.g., by specifying framework versions and random seeds. The directory is once again subdivided into sub-directories for each individual structured benchmark program, which in turn contain an additional sub-directory for each development front-end used (e.g. `benchmarks/_recipes/structured/quantum_teleportation/qiskit/`). + +The modular directory structure allows future adaptations and extensions of the benchmark suite, either by adding other structured programs or by also including entirely new categories of benchmarks. -In cases where the programs are adaptive in their size, it uses dynamic input parameters to keep the program implementation agnostic of the specifically desired size. +## Benchmark Program Structure + +In cases where the programs are adaptive in their size, the benchmark definitions use dynamic input parameters to keep the program implementation agnostic of the specifically desired size. This may include examples such as arbitrarily sized GHZ state preparation, where the number of qubits is specified as an input parameter at runtime. Similarly, programs that require classical input data such as rotation angles use input parameters to allow users to specify the data at runtime. An example of this might be a VQA ansatz that is repeated several times using `for` loops. @@ -39,9 +49,13 @@ An example of this might be a VQA ansatz that is repeated several times using `f In contrast, some programs are provided with fixed sizes and parameters, either because they cannot easily be generalized or because they are intended as simpler test scenarios for basic compiler functionality. Examples of this include simple Quantum Teleportation programs, or predefined instances of Grover's search algorithm. -The modular directory structure allows future adaptations and extensions of the benchmark suite, either by adding other structured programs or by also including entirely new categories of benchmarks. +## Further Information + +Additionally, a `README.md` file is included in the `benchmarks/structured` directory. +This file provides an overview of the available benchmarks, including descriptions of each program and the structured control flow features they utilize. +It is used to track the progress of implementing the benchmarks and serves as a reference for users looking to understand the capabilities of different quantum compilers. -While this feature may not directly impact the way many users interact with Jeff, it provides a valuable resource for evaluating and improving quantum compilers and test their compatibility with Jeff and advanced quantum programming features. +While the desired results proposed in this RFC may not directly impact the way many users interact with Jeff, they provide a valuable resource for evaluating and improving quantum compilers and test their compatibility with Jeff and advanced quantum programming features. # Implementation-level explanation [implementation-level-explanation]: #implementation-level-explanation From 87f3d149bb25c1bebdc0258650dbc934b95bfb6f Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 13 Nov 2025 13:47:06 +0100 Subject: [PATCH 14/17] docs: :memo: add information on format features to "Guide-level explanation" --- rfcs/text/0032-structured-benchmark-programs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index cb94641..5c2d7a0 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -55,6 +55,8 @@ Additionally, a `README.md` file is included in the `benchmarks/structured` dire This file provides an overview of the available benchmarks, including descriptions of each program and the structured control flow features they utilize. It is used to track the progress of implementing the benchmarks and serves as a reference for users looking to understand the capabilities of different quantum compilers. +The README file also includes information on what particular structured control flow features are supported by different existing formats and toolchains, helping users to identify which tools are best suited for the corresponding needs. + While the desired results proposed in this RFC may not directly impact the way many users interact with Jeff, they provide a valuable resource for evaluating and improving quantum compilers and test their compatibility with Jeff and advanced quantum programming features. # Implementation-level explanation From c554a310a04a28b3f89218c8bb4f9e8df20ec7b3 Mon Sep 17 00:00:00 2001 From: Damian Rovara Date: Thu, 13 Nov 2025 15:01:34 +0100 Subject: [PATCH 15/17] docs: :memo: add newly suggested benchmark programs to the table --- rfcs/text/0032-structured-benchmark-programs.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 5c2d7a0..37c5a01 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -77,6 +77,9 @@ Further details on each program type are provided in the sections that follow th | Grover's Search with Weak Measurement | ❌ | ✔️ | ❌ | ❌ | 🟦 | ✔️ | ❌ | ❌ | [Paper](https://iopscience.iop.org/article/10.1088/2058-9565/ac47f1/meta) | ✔️ | ✔️ | | GHZ State Preparation | ✔️ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | [Wikipedia](https://en.wikipedia.org/wiki/GHZ_state) | ✔️ | ❌ | | Quantum Fourier Transform (QFT) | ✔️ | ❌ | ✔️ | 🟦 | ❌ | ❌ | ❌ | ❌ | [Nielsen and Chuang](https://doi.org/10.1017/CBO9780511976667) | ✔️ | ❌ | +| 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 | ✔️ | ✔️ | | 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) | ✔️ | ✔️ | @@ -87,12 +90,15 @@ Further details on each program type are provided in the sections that follow th | ML-QAE | ❌ | ✔️ | ✔️ | ❓ | ❓ | ✔️ | ❌ | ❌ | [Paper](https://arxiv.org/abs/1904.10246) | ❌ | ✔️ | | Quantum Multiplexers | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ❌ | [Paper](https://arxiv.org/abs/quant-ph/0410066) | ✔️ | ✔️ | | 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) | ❌ | 🟦 | + ### Symbol Legend From 35dbca9a0972eea0cd7534d8676f52b034206aee Mon Sep 17 00:00:00 2001 From: Damian Rovara <93778306+DRovara@users.noreply.github.com> Date: Thu, 13 Nov 2025 22:08:40 +0100 Subject: [PATCH 16/17] Update rfcs/text/0032-structured-benchmark-programs.md Co-authored-by: Lukas Burgholzer --- rfcs/text/0032-structured-benchmark-programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 37c5a01..3c73972 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -8,7 +8,7 @@ Quantum programs involving structured control flow operations such as `if` and `for` can only be represented in severely limited ways through existing quantum program formats. Qiskit does not allow dynamic qubit indexing, which is crucial for semantic `for` loops. Similarly, while OpenQASM 3 does not explicitly prohibit dynamic indexing, it leaves it open as an optional feature that many backends do not support. Jeff, on the other hand, has the ability to represent such programs, making it the ideal format for expressing a set of structured benchmark programs. These programs can then be used as a set of challenges for quantum compilers to drive the development of more advanced compilation techniques. This RFC proposes to: -- gather and provide a list of important patterns and algorithms that contain structure and/or dynamism +- gather and provide a list of important patterns and algorithms that contain structure and/or dynamism. - create a collection of artifacts representing these patterns/algorithms using various existing software program representations, and determine ecosystem support. - set a challenge to the broader community to start thinking about compiling such programs efficiently by adding support and optimizations for them to their toolchains. From c066d5f9eae661de9c36742c93739e2d821fdbcc Mon Sep 17 00:00:00 2001 From: Damian Rovara <93778306+DRovara@users.noreply.github.com> Date: Thu, 13 Nov 2025 22:08:55 +0100 Subject: [PATCH 17/17] Update rfcs/text/0032-structured-benchmark-programs.md Co-authored-by: Lukas Burgholzer --- rfcs/text/0032-structured-benchmark-programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/text/0032-structured-benchmark-programs.md b/rfcs/text/0032-structured-benchmark-programs.md index 3c73972..c685b1e 100644 --- a/rfcs/text/0032-structured-benchmark-programs.md +++ b/rfcs/text/0032-structured-benchmark-programs.md @@ -201,7 +201,7 @@ There are several potential drawbacks to consider with this proposal: - Maintenance Overhead: The addition of a new benchmark suite requires ongoing maintenance to ensure that the benchmarks remain relevant and up-to-date with the latest advancements in quantum computing and compiler technologies. - Complexity: Introducing structured benchmarks may increase the complexity of the Jeff repository, potentially making it more challenging for new users to navigate and understand the available resources. - Limited Adoption: If the benchmarks are not widely adopted by the quantum computing community, their impact may be limited, reducing the incentive for compiler developers to implement support for structured control flow. -- Comparisons are not simple: For users, it might not be stratighforward to know what to compare against when compiling these structured programs. For a full, fair evaluation, a meaningful baseline needs to be established and a more precise methodology for comparison is likely necessary. +- Comparisons are not simple: For users, it might not be straightforward to know what to compare against when compiling these structured programs. For a full, fair evaluation, a meaningful baseline needs to be established and a more precise methodology for comparison is likely necessary. # Rationale and alternatives [rationale-and-alternatives]: #rationale-and-alternatives