← Latest papers
⚛️ quantum physics

Qupertino: Pure MLX Array Kernels versus Hand-Tuned Metal Shaders for Quantum Circuit Simulation on Apple Silicon

The paper introduces Qupertino, an open-source quantum circuit simulator for Apple Silicon that demonstrates how hand-tuned Metal shaders significantly outperform pure MLX array operations, achieving up to 95x speedups over existing CPU and GPU-based simulators while maintaining exact correctness across diverse quantum workloads.

Original authors: Shlomo Kashani

Published 2026-09-18
📖 6 min read🧠 Deep dive

Original authors: Shlomo Kashani

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

To understand the work presented here, one must first grasp the nature of the challenge facing modern quantum computing. Quantum computers are not simply faster versions of the machines we use today; they operate on a fundamentally different set of physical rules, manipulating information in a way that allows them to explore many possibilities at once. Because these machines are still in their early stages, prone to errors and limited in size, scientists rely heavily on classical computers to simulate how they should behave. This simulation is a critical tool for testing algorithms and calibrating real hardware. However, simulating a quantum system is notoriously difficult because the amount of information required to describe it grows explosively with every added particle. To simulate a system of just twenty-five particles, a computer must track a vast array of numbers, a task that pushes even the most powerful supercomputers to their limits. The question has long been whether the latest generation of consumer computers, specifically those using Apple's custom chips, could handle this burden efficiently, and if so, how much of that power comes from clever software versus raw hardware engineering.

A researcher has addressed this by building a new simulation tool called Qupertino, designed specifically for Apple Silicon processors. These processors are unique because they use a unified memory architecture, meaning the central processor and the graphics processor share the same pool of memory without needing to copy data back and forth between them. This design removes a significant bottleneck found in traditional computers, where moving large amounts of data between separate memory banks slows everything down. The researcher wanted to know exactly how far they could get using only the standard, high-level programming tools available on these chips, and how much extra performance could be gained by writing custom, low-level code specifically tuned for the graphics processor. They set out to compare two approaches: one that relied entirely on standard array operations, and another that incorporated hand-crafted instructions designed to squeeze out every drop of speed from the hardware.

The study revealed that the standard approach, while impressive, leaves a significant amount of performance on the table. When the researcher ran their simulations using only the standard array operations, the software was already faster than existing tools running on central processors. However, when they enabled the second tier of their system—using custom, hand-tuned instructions for the graphics processor—the speed increased dramatically. For certain complex tasks, such as simulating the Fourier transform used in many quantum algorithms, the custom-tuned version was nearly ninety-five times faster than the standard processor-based tools and nearly one hundred times faster than the PennyLane simulation software. In other scenarios, such as simulating the evolution of magnetic systems, the custom approach was still more than thirty times faster. The researcher measured these results carefully, running the same tests repeatedly on the same machine to ensure the differences were real and not just random fluctuations. They found that the custom-tuned approach was the fastest by mean runtime in all eighteen comparison cells, though on specific sparse circuits like Grover search at 25 qubits, it was statistically tied with the CPU baseline, and on the smallest gate-sparse circuits at 15 qubits, the CPU baselines remained faster.

The key to this performance gap lies in how the software handles the structure of the quantum circuits. The standard approach treats every gate, or operation, in a somewhat generic way, even when many of those gates follow a predictable pattern. The custom-tuned approach, however, recognizes these patterns. For example, when a series of operations simply rotates the phase of the quantum state, the custom code calculates this in a single, streamlined pass rather than processing each step individually. Similarly, when the simulation involves swapping the positions of particles or applying a specific type of mathematical transformation, the custom code groups these actions together to execute them as one unified block. This is akin to a delivery driver who, instead of stopping at every house on a street to drop off a single package, loads all the packages for that street and drops them off in one efficient trip. By recognizing and exploiting these patterns, the custom code reduces the number of times the computer has to access its memory, which is the most time-consuming part of the process.

Despite these massive speed gains, the researcher was careful to ensure that the custom code did not change the results. They built a system that automatically detects when a circuit fits a pattern that can be optimized and routes it to the custom code, while leaving everything else to run on the standard path. They verified that the results from the custom code matched the standard code perfectly, down to the smallest decimal place. This means that users can get the speed of the custom code without sacrificing accuracy. The tool also supports a wide variety of quantum algorithms, including those used for optimization, searching, and simulating chemical reactions. It even includes a method to simulate systems with up to one hundred and fifty particles, provided those systems are not too entangled, a feat that would be impossible with the standard approach on the same hardware.

The findings suggest that while modern consumer hardware is powerful enough to run sophisticated quantum simulations, the software running on it must be equally sophisticated to unlock its full potential. The unified memory of Apple Silicon provides a solid foundation, removing the need for data copying, but the real speed comes from writing code that understands the specific structure of the problem. The researcher demonstrated that a simulator written purely in standard operations is a viable tool, but one that leaves a twenty-five to thirty-three times performance gap compared to a version that uses hand-tuned instructions. This gap is not a failure of the hardware, but rather a reminder that in the world of high-performance computing, the most efficient path often requires a deep understanding of the machine's architecture. The work provides a clear roadmap for how to build faster simulators for the next generation of quantum experiments, showing that the combination of unified memory and carefully crafted code can push the boundaries of what is possible on a single desktop computer.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →