Table of Contents
Fetching ...

Unitary Expressions: A Necessary Abstraction for Extensible Quantum Programming Languages and Systems

Ed Younis

TL;DR

The paper addresses the fragility and rigidity of gate-name-based quantum software by introducing unitary expressions as a first-class abstraction. It presents OpenQudit, comprising the Qudit Gate Language (QGL) for unitary expressions, the QCIR intermediate representation that uses expression identity, and the Qudit Virtual Machine (QVM) for fast unitary and gradient evaluation; these components support symbolic differentiation, optimization, and efficient compilation through two pipelines. Key contributions include a scalable e-graph–based optimization framework, a novel congruence notion that handles global phase and parameter mappings, and a high-performance, qudit-capable runtime that demonstrates substantial speedups over existing frameworks in both unitary and gradient computations. The work enables safe tool composition, extensibility to new gates and hardware, and streamlined interoperability across quantum programming languages and runtimes, with practical impact demonstrated in circuit construction benchmarks and large-scale QFT synthesis.

Abstract

Quantum gates are the fundamental instructions of digital quantum computers. Current programming languages, systems, and software development toolkits identify these operational gates by their titles, which requires a shared understanding of their meanings. However, in the continuously developing software ecosystem surrounding quantum computing -- spanning high-level programming systems to low-level control stacks -- this identification process is often error-prone, challenging to debug, maintenance-heavy, and resistant to change. In this paper, we propose replacing this nominal gate representation with a functional one. We introduce the OpenQudit system for describing, parsing, optimizing, analyzing, and utilizing programs comprising gates described as symbolic unitary expressions. As part of this effort, we design the Qudit Gate Language (QGL), a unitary-specific expression language, and implement a differentiating just-in-time compiler in OpenQudit towards embedding this language in quantum programming languages and systems. Additionally, we have precisely designed and implemented the Qudit Virtual Machine (QVM) to evaluate quantum programs and their gradients efficiently. This evaluation is performed millions of times during the compilation of quantum programs. Our QVM can compute gradients approximately ten times faster than current leading numerical quantum compilation frameworks in the most common use cases. Altogether, the OpenQudit system is envisioned to (1) support many-level or qudit-based quantum systems, (2) enable the safe composition of program transformation tools, (3) accelerate circuit optimizers and transpilers, (4) enable compiler extensibility, and (5) provide a productive, simple-to-use interface to quantum practitioners.

Unitary Expressions: A Necessary Abstraction for Extensible Quantum Programming Languages and Systems

TL;DR

The paper addresses the fragility and rigidity of gate-name-based quantum software by introducing unitary expressions as a first-class abstraction. It presents OpenQudit, comprising the Qudit Gate Language (QGL) for unitary expressions, the QCIR intermediate representation that uses expression identity, and the Qudit Virtual Machine (QVM) for fast unitary and gradient evaluation; these components support symbolic differentiation, optimization, and efficient compilation through two pipelines. Key contributions include a scalable e-graph–based optimization framework, a novel congruence notion that handles global phase and parameter mappings, and a high-performance, qudit-capable runtime that demonstrates substantial speedups over existing frameworks in both unitary and gradient computations. The work enables safe tool composition, extensibility to new gates and hardware, and streamlined interoperability across quantum programming languages and runtimes, with practical impact demonstrated in circuit construction benchmarks and large-scale QFT synthesis.

Abstract

Quantum gates are the fundamental instructions of digital quantum computers. Current programming languages, systems, and software development toolkits identify these operational gates by their titles, which requires a shared understanding of their meanings. However, in the continuously developing software ecosystem surrounding quantum computing -- spanning high-level programming systems to low-level control stacks -- this identification process is often error-prone, challenging to debug, maintenance-heavy, and resistant to change. In this paper, we propose replacing this nominal gate representation with a functional one. We introduce the OpenQudit system for describing, parsing, optimizing, analyzing, and utilizing programs comprising gates described as symbolic unitary expressions. As part of this effort, we design the Qudit Gate Language (QGL), a unitary-specific expression language, and implement a differentiating just-in-time compiler in OpenQudit towards embedding this language in quantum programming languages and systems. Additionally, we have precisely designed and implemented the Qudit Virtual Machine (QVM) to evaluate quantum programs and their gradients efficiently. This evaluation is performed millions of times during the compilation of quantum programs. Our QVM can compute gradients approximately ten times faster than current leading numerical quantum compilation frameworks in the most common use cases. Altogether, the OpenQudit system is envisioned to (1) support many-level or qudit-based quantum systems, (2) enable the safe composition of program transformation tools, (3) accelerate circuit optimizers and transpilers, (4) enable compiler extensibility, and (5) provide a productive, simple-to-use interface to quantum practitioners.
Paper Structure (22 sections, 7 equations, 9 figures, 2 tables)

This paper contains 22 sections, 7 equations, 9 figures, 2 tables.

Figures (9)

  • Figure 1: Overview of the two compilation pipelines in OpenQudit working towards efficient simulation of quantum circuits and their gradients. The bottom pipeline begins with unitary expressions formatted as Qudit Gate Language programs. It differentiates and optimizes these programs before exporting them as a module for later use by a Qudit Virtual Machine. The top pipeline, responsible for generating optimized instructions to simulate quantum circuits, first extracts an expression tree by solving the tensor contraction ordering problem over the input circuit. Further optimizations are performed on the resulting expression tree, including expression fusion, before final bytecode generation.
  • Figure 2: Several standard gate definitions. The first two rows give many examples of parameterized single-qubit operations. CNOT and RZZ are two-qubit entangling operations. While there is a common understanding of many qubit-based operations, there are more potential qutrit and higher-dimensional qudit gates with no similar standard set. The qutrit phase operator is an example of an executable native gate on many qutrit-based computers.
  • Figure 3: Two quantum programs illustrated in the circuit model. The left circuit comprises U3 and CNOT gates acting on three qubits. The starting state of the qubits is labeled on the left as $\ket{q_i}$; however, on the right, they are not labeled and are assumed to be indexed starting from the top and counting down. The right circuit uses a more diverse gate set that includes RX, RY, and RZ rotations.
  • Figure 4: Three examples of quantum gate unitary expressions in the Qudit Gate Language. The constant CNOT 2-qubit gate on the left requires no parameters. The U2 gate in the middle uses Greek letters and a matrix-scalar operation for readability. The qutrit phase gate on the right specifies the radices "<3>", implying a single-qutrit gate.
  • Figure 5: The expression tree intermediate and final bytecode resulting from compiling the example circuit in Figure \ref{['fig:circuit']}. The compilation process fused two subtrees, requiring new fused expressions to be compiled in parallel with this simulation compilation. The resulting bytecode is split into two sections: static and dynamic. The static section is only executed once, whereas the dynamic section is executed every time, assuming the static code has already been run.
  • ...and 4 more figures

Theorems & Definitions (3)

  • Definition 1: Symbolic Circuit Equivalence
  • Definition 2: Global Phase Congruence
  • Definition 3: Symbolic Circuit Congruence