Research analysis · Neuromorphic software tooling

A compiler path for spiking networks from NIR to bare-metal C

snn-mlir is an open-source MLIR dialect that turns a spiking network exchanged in the NIR format into verified, dependency-free C11 code. Floating-point builds reproduce the training framework bit-for-bit; integer builds are bit-identical across an x86 laptop and a 15 MHz RISC-V core. Silicon spiking networks just acquired the kind of semantics contract that living-tissue computing has never had.

Source: SNN-MLIR: An MLIR Dialect for Compiling Neuromorphic SNNs from NIR to Bare-Metal C, arXiv (cs.PL), 8 June 2026. Primary source. Read in full (arXiv HTML rendering of v1).

What the work claims

This is a systems-and-methods paper by two authors at INTERA-Group in Barcelona. The neuromorphic field had solved model exchange but not deployment: the Neuromorphic Intermediate Representation (NIR), published by Pedersen and colleagues in Nature Communications in 2024, defines a framework-neutral vocabulary of neuron and synapse primitives that every major training framework can export, but it deliberately stops at describing what a network is.2 From a NIR file to a running executable, every backend was on its own, hand-writing inference loops and ad hoc quantization, with the classic failure mode of silent scale mismatches between a synapse layer and the neuron it drives.

The claim: a small MLIR dialect fixes the missing middle. Six operations (a linear synapse with optional bias, a rescale operation, and four members of the current-based leaky integrate-and-fire family) model the whole network as first-class compiler IR, with each operation type-polymorphic across floating point and quantized integers. A Python front end ingests any NIR graph and emits the dialect, automatically inserting rescaling operations where quantization scales differ between adjacent layers. A single lowering pass rewrites the dialect into standard MLIR linalg and arith operations, from which stock tools produce self-contained C11 code that compiles for any C-capable target.1

How it works

Three design choices do the work. First, the dialect is memref-based: neuron state lives in memory references updated in place across timesteps, which matches both the persistence semantics of spiking neurons and the buffers an embedded target actually allocates. Second, it is explicitly typed, so the same operation on f32 activations and on i32 state with i8 spikes is one op with one verifier and one lowering, not two parallel code paths that can drift apart. Third, it is one IR for simulation and deployment: the same graph lowers in floating point as a bit-faithful reference and again in quantized form for hardware, so the reference and the deployed artifact cannot silently diverge.1

The quantization scheme is deliberately conservative: power-of-two, shift-based. Weights are quantized to i8 with a single per-layer scale chosen so the largest-magnitude weight maps near the i8 range; neuron dynamics run in Q12 fixed point with i32 state and i8 spike outputs. Because synapse and neuron scales are chosen independently, the front end inserts a synthetic rescale op on every synapse-to-neuron edge whose shift equals the difference of the two scale exponents, turning what would be a silent numerical corruption in hand-written code into a structurally guaranteed alignment. The worked example in the paper is a synapse emitting at scale 2 to the 7 feeding a neuron at Q12, bridged by a single left shift of 5.1

The evaluation is validation-oriented and candid. On two example networks exported from different frameworks (a two-layer current-based LIF network from Lava-DL and a four-layer snnTorch network), floating-point builds are bit-exact against the reference: every output cell matches, with zero mismatches out of 20,000 and 250 cells respectively. Quantized i8 builds are no longer bit-exact, but they are deterministic across architectures: the x86 host and the X-HEEP 32-bit RISC-V core on FPGA at 15 MHz produce identical mismatching cells and identical spike counts (99.585 percent bit accuracy on one network, 92.000 percent on the other). On-target footprint is a fixed 12,584 bytes of code and runtime plus weight and state buffers of 114,416 and 172,912 bytes. Against running the same networks in their Python frameworks on the same host, the compiled i8 binaries are about 266x and 157x cheaper per timestep in cycles, which the authors correctly attribute mostly to removing interpreter overhead, not to any peak-performance breakthrough.1

Where a skeptic should push

The load-bearing assumption is that a deliberately tiny subset is a foundation rather than a dead end. The current dialect handles feedforward, fully-connected, linear-chain graphs, batch size one, with uniform per-layer neuron parameters; no convolutions, no branching, no recurrence. The authors are honest that recurrent support would be needed to reach liquid-state machines, the reservoir class most relevant to anyone interested in physical or biological substrates. Two example networks from the project's own repository, evaluated for spike-train fidelity rather than task accuracy, is a demonstration of correctness, not of utility.

Two numbers deserve care in quotation. The headline speedups (266x, 157x) compare against a Python interpreter paying tensor-allocation and dispatch costs every timestep, roughly 85 to 95 ms per step in the framework versus well under a millisecond compiled; that is a deployment-overhead removal, and the paper says so. The 8 percent fidelity loss on the snnTorch network under i8 quantization is real and network-dependent; buyers of quantized deployment should expect to pay an accuracy tax that varies with the model. Finally, deterministic integer behavior across x86 and RISC-V is a strong result, but it holds because the scheme is shift-based integer-only; any float fallback on an exotic target would break the promise, and the scheme's reach is bounded by its own simplicity.1

Verified semantics: silicon's bar, tissue's gap

Strip the software detail away and the paper is about a contract: here is exactly what this network computes, in a representation a machine verifies; here is how faithfully the deployed artifact reproduces the reference, measured cell by cell; here is what is supported and what is not, enforced by verifiers rather than promised in prose. Organoid intelligence has nothing of the kind. A culture on a multielectrode array is typically described by what it did on one benchmark, on one batch of tissue, with the readout training pipeline and the stimulation calibration treated as incidental. The non-obvious implication of snn-mlir is that the field's missing piece is not bigger or smarter tissue but a specification layer: a typed, checkable description of what the preparation is claimed to compute, against which the actual dish-plus-readout system is audited, with deviations quantified the way this paper quantizes fidelity per cell.

The most transferable mechanism is the automatic rescale. Silent scale mismatch between adjacent stages is not a compiler-only disease. It is the same failure family as a stimulation calibration that drifts between sessions, a spike-detection threshold tuned per recording rather than per protocol, or a readout retrained on a different preprocessing pipeline; each is an interface between components whose units stopped agreeing, discovered only when results misbehave. The paper's answer, align the scales by construction and verify the alignment mechanically, is a design principle OI protocols can adopt today: fix the units of stimulation, recording, and readout in a machine-checkable contract, and refuse to run when they disagree, rather than discovering disagreement in the data.

The threat is the maturity gap itself. Silicon spiking networks are quietly assembling a full industrial stack: exchange format, compiler IR, verified lowering, deterministic deployment on microcontrollers, open-source tooling. Every layer raises the evidentiary standard for anyone claiming computational value from a substrate. Living tissue's defense, that it self-organizes and adapts in ways silicon does not, is precisely the property that makes a verifier-style contract hardest to write, and the field has mostly used that difficulty as an excuse to skip the attempt. The opportunity is to stop skipping it. A bounded, verifier-enforced claim about a cultured network (this preparation, this stimulation regime, this readout, this measured fidelity against this reference) would be worth more than another accuracy headline, because it would be the first claim an outsider could mechanically check.

The bottom line

Established: NIR-described spiking networks can be compiled through a small MLIR dialect to dependency-free C11 with bit-exact floating-point fidelity to the source framework and bit-identical integer behavior across x86 and RISC-V targets, with automatic, structurally guaranteed quantization-scale alignment. Hypothesis: the dialect generalizes to convolutional, recurrent, and neuromorphic-hardware backends; the current linear-chain, uniform-parameter subset is a foundation only if those extensions land. What would confirm it: recurrent or convolutional networks compiled with the same fidelity guarantees, and a vendor backend (Loihi 2 or SpiNNaker) sharing the same verifier and op set. What would weaken it: evidence that the power-of-two quantization scheme costs task accuracy that more flexible schemes avoid. For the OI reader: this is what a verification culture looks like, and its absence is now a choice, not a fate.

Frequently asked questions

What is NIR and what gap does this paper fill?

NIR (Neuromorphic Intermediate Representation) is a framework-neutral format for exchanging trained spiking networks between tools like snnTorch, Lava, and Norse. It defines what a network is but not how to run it. This paper supplies the missing compiler layer: MLIR dialect operations that verify, transform, and lower a NIR model to standalone C11 code.

How accurate is the compiled code?

In floating point, bit-exact against the source frameworks on both test networks. In i8 quantized mode, deterministic and identical across an x86 host and a RISC-V embedded core, at 99.585 percent and 92.000 percent per-cell spike agreement; the accuracy loss under quantization is small for one network and about 8 percent for the other.

What is the automatic rescale mechanism?

Synapse layers and neuron dynamics use independently chosen fixed-point scales that almost never match. The compiler inserts a rescale operation on every synapse-to-neuron edge whose integer shift equals the difference of the two scale exponents, so inter-layer scale alignment is guaranteed by construction instead of being a silent source of numerical error in hand-written code.

Are the 266x speedups a hardware breakthrough?

No. They measure removal of Python interpreter and runtime overhead per timestep, which dominated the framework baseline. The paper states this explicitly and frames the result as a portable deployment path, not a peak-performance claim.

What are the current limitations?

Feedforward, fully-connected linear-chain topologies only, batch size one, and uniform neuron parameters per layer. Convolutional, branching, and recurrent graphs are unsupported today; the authors identify recurrence as the key extension for reaching reservoir-computing models such as liquid state machines.

Is the toolchain open source?

Yes, under Apache-2.0 with LLVM-exception, at github.com/INTERA-GROUP/snn-mlir. Only the dialect and one lowering pass are new; everything below reuses unmodified MLIR and LLVM tools.

References

  1. A. García Gener and Á. Rollón de Pinedo. SNN-MLIR: An MLIR Dialect for Compiling Neuromorphic SNNs from NIR to Bare-Metal C. arXiv:2606.09213 (cs.PL). 2026. http://arxiv.org/abs/2606.09213v1. Accessed 2026-09-02.
  2. J. E. Pedersen, S. Abreu, M. Jobst, G. Lenz, V. Fra, F. C. Bauer, D. R. Muir, P. Zhou, B. Vogginger, K. Heckel, G. Urgese, S. Shankar, T. C. Stewart, S. Sheik, and J. K. Eshraghian. Neuromorphic intermediate representation: a unified instruction set for interoperable brain-inspired computing. Nature Communications 15:8122. 2024. https://doi.org/10.1038/s41467-024-52259-9. Accessed 2026-09-02.