Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

miniflash logo

MiniFlash

A mini and fast Clifford+T → lattice-surgery compiler.

documentation MIT license python 3.9+ pure python

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.

Quickstart

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.py

SAT 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

About

A fast Clifford+T to lattice-surgery compiler.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages