A mini and fast Clifford+T → lattice-surgery compiler.
MiniFlash turns a Clifford+T circuit (OpenQASM 2.0) into a fault-tolerant lattice-surgery layout: the explicit 3-D spacetime volume that a surface-code quantum computer would execute, with logical qubits traced as pipes and every surgery, Hadamard and magic-state injection placed. The result is a self-contained glTF scene — open it in any 3-D viewer. Cell synthesis is LaSsynth (Tan, Niu, Gidney — ISCA 2024). Read the full documentation.
pip install -e .
python scripts/download_lassynth.py # fetch LaSsynth from its Zenodo artifact (sha256-pinned)
python main.py benchmarks/algorithms/ghz8.qasm -o ghz8.gltf
# open in any glTF viewer, e.g. https://gltf-viewer.donmccurdy.com/Partitioning is coarse-first: regions start at whole-circuit granularity
and split in place whenever a region exhausts its per-region SAT budget
(--budget, default 600 s). Compilation starts cold and warms the cell
cache as it goes; optionally pre-warm it from the published archive
(cache-v1 release, sha256-pinned):
python scripts/download_cache.pySAT solving uses
kissat when available — build it
and point MINIFLASH_KISSAT_DIR at the directory holding the kissat
binary — and falls back to z3 otherwise. benchmarks/ ships 175
circuits to try (ghz/bv/dj, random Clifford, graph states, gf-mult,
Toffoli, ...).
As a library — the pipeline runs to the Program IR, and the package's own backend renders it:
import miniflash as flash
circuit = flash.parse("circuit.qasm")
pc = flash.partition(circuit) # PartitionedCircuit: .regions / .events / .to_text() / .save_png()
floorplan, cells, channels = flash.synthesize(pc)
program = flash.elaborate(floorplan, cells, events=pc.events, channels=channels)
layout = flash.build_layout(program) # check -> lower
flash.write_gltf(layout, "layout.gltf")
import json
json.dump(program.stats(), open("stats.json", "w"), indent=2) # volumes, pauli frames, T corrections