Transformations for Accelerator-based antum Circuit
Simulation in Haskell
YOUSSEF MOAWAD, University of Glasgow, UK
WIM VANDERBAUWHEDE, University of Glasgow, UK
RENÉ STEIJL, University of Glasgow, UK
For ecient hardware-accelerated simulations of quantum circuits, we can dene hardware-specic quantum-
circuit transformations. We use a functional programming approach to create a quantum-circuit analysis and
transformation method implemented in Haskell. This tool forms a key part of our larger quantum-computing
simulation toolchain. As an example of hardware acceleration, we discuss FPGA-based simulations of selected
quantum arithmetic circuits, including the transformation steps to optimise the hardware utilisation. Future
development steps in the Haskell-based analysis and transformation tool are outlined. The described toolchain
can be found on GitHub: https://github.com/DevdudeSami/fqt.
1 INTRODUCTION
Ecient simulation of quantum computers is essential for the development of quantum algorithms
and for further development of quantum hardware. Quantum computers promise to deliver up to
exponential complexity improvements for certain algorithms[16]; however, this is also where the
diculty in simulating them arises. The state of a coherent
𝑛
-qubit quantum register in a quantum
processor can be dened using 2
𝑛
complex numbers, also termed the quantum state vector. In
contrast to the register in a classical computer, the quantum state in a coherent qubit register is
in a state of superposition until quantum measurement operations are performed. Measurement
(partially) collapses the quantum state superposition, and the complex amplitudes dene the
likelihood of nding a given state after measurement. Quantum superposition is the key principle
creating the potential speed-up for most quantum algorithms.
The Quantum Circuit Model is the most common model for interacting with current quantum
hardware and reasoning about quantum algorithms. In this work, Qubit-Wise Multiplication (QWM)
is chosen as the baseline simulation method. While this requires the storage of the full state-vector,
2
𝑛
complex amplitudes, it does give the most control and allows full inspection of the state during
computation. To process one quantum gate in QWM, the entire state vector is updated. Data-locality
during these operations is not guaranteed, as pairs of amplitudes have to be accessed with strides
that grow exponentially depending on the target qubit. However, for each gate, due to the implied
quantum parallelism, these operations can be executed in parallel.
Classical simulations of quantum circuits are most commonly performed on multicore computers
and clusters[
5
,
6
]. A range of high-performance simulators exists. Typically, the quantum-circuit
implementation of quantum algorithms is represented by a Domain Specic Language (e.g. QASM).
Quantum computer simulations have also been performed on GPUs[
8
,
10
] and FPGAs[
1
,
11
,
13
,
17
].
The underlying idea of such hardware-accelerated simulations is to use the specic hardware
features to process the quantum circuit more eciently. In our ongoing research, we focus on
FPGAs (Field Programmable Gate Arrays) as accelerators. FPGAs are programmable circuits that
allow to construct highly parallel architectures that closely mimic the properties of quantum
computing. To allow us to investigate dierent architectures, we developed a quantum simulation
toolchain that includes a Quantum Circuit Analysis and Transformation tool. We target quantum
algorithms for computational science and engineering applications. In contrast to a signicant body
of work focusing on general and even randomized circuits, the present work aims to explicitly take
advantage of the quantum-circuit structure using the knowledge of the domain experts developing
1
arXiv:2210.12703v1 [quant-ph] 23 Oct 2022