HUGR: A Quantum-Classical Intermediate Representation
Mark Koch, Agustín Borgna, Seyon Sivarajah, Alan Lawrence, Alec Edgington, Douglas Wilson, Craig Roy, Luca Mondada, Lukas Heidemann, Ross Duncan
TL;DR
The paper addresses the need for an intermediate representation capable of expressing hybrid quantum-classical programs with real-time classical control beyond fixed circuits. It introduces HUGR, a dataflow-graph based IR with typed edges, hierarchical control, function support, and an extensible extension system to capture evolving quantum programming paradigms. The design emphasizes pattern-matching based optimisation and static typing, including linear quantum types, to enable safe, scalable tooling, and provides an open-source reference implementation. Compared with QIR and MLIR, HUGR aims for richer expressivity for hybrid programs while maintaining independence from MLIR for stability and safety.
Abstract
We introduce the Hierarchical Unified Graph Representation (HUGR): a novel graph based intermediate representation for mixed quantum-classical programs. HUGR's design features high expressivity and extensibility to capture the capabilities of near-term and forthcoming quantum computing devices, as well as new and evolving abstractions from novel quantum programming paradigms. The graph based structure is machine-friendly and supports powerful pattern matching based compilation techniques. Inspired by MLIR, HUGR's extensibility further allows compilation tooling to reason about programs at multiple levels of abstraction, lowering smoothly between them. Safety guarantees in the structure including strict, static typing and linear quantum types allow rapid development of compilation tooling without fear of program invalidation. A full specification of HUGR and reference implementation are open-source and available online.
