Spiking neural networks (SNNs) have an interoperability problem: SnnTorch, Lava, Norse, and a dozen other frameworks each export models in their own format. The Neuromorphic Intermediate Representation (NIR) solved the exchange part but stopped short of telling anyone how to actually run the network on a target device. SNN-MLIR closes that gap by compiling any NIR-formatted model into self-contained C11 code with zero runtime dependencies.
NIR Solved Exchange, Not Deployment
NIR gave the community a common interchange format, but each backend still had to write its own deployment pipeline from scratch. No shared compiler representation meant every new hardware target required duplicating optimization passes, quantization logic, and code generation. The authors of SNN-MLIR recognized that pattern and built a proper MLIR dialect to serve as the missing intermediate layer between NIR and bare metal.
Type-Polymorphic Ops Handle Float and Quantized Data Uniformly
The dialect defines a small set of type-polymorphic operations that work identically on f32, f64, and quantized data. That means a single intermediate representation can feed both simulation workflows and hardware-oriented deployment. A Python frontend reads any NIR file, emits the dialect IR, and automatically inserts rescaling operations to keep quantization scales consistent across layers—no manual annotation required.
From NIR to C in Three Passes
The toolchain takes a NIR file and runs it through a reference lowering pass that converts the dialect to standard linalg and arith operations. From there, the existing MLIR-to-LLVM pipeline generates C11 code. The output is a single self-contained .c file with no external dependencies—no runtime library, no framework imports. It compiles and runs on any C-capable CPU or embedded target. The current scope covers feedforward, fully-connected networks with a CPU backend, but the architecture is designed to extend to convolutional topologies and accelerator targets.
Numerical Fidelity and Portability Verified
The authors evaluated numerical fidelity against reference outputs, portability across multiple CPU targets, and the cost of quantization. The results show faithful reproduction of the original floating-point and quantized computations. SNN-MLIR is open source under the Apache-2.0 license with LLVM-exception and is already available on GitHub.
By giving SNN researchers a standard compiler pipeline fed by NIR, SNN-MLIR removes the biggest friction point in neuromorphic deployment—getting models off the researcher's workstation and onto silicon. The next step is extending beyond feedforward topologies, but the compiler infrastructure is in place.
Source: SNN-MLIR: An MLIR Dialect for Compiling Neuromorphic SNNs from NIR to Bare-Metal C
Domain: arxiv.org
Comments load interactively on the live page.