SNN-MLIR: An MLIR Dialect for Compiling Neuromorphic SNNs from NIR to Bare-Metal C
2026-06-08 • Programming Languages
Programming LanguagesMachine Learning
AI summaryⓘ
The authors describe snn-mlir, a tool that helps run spiking neural networks (SNNs) across different software frameworks by providing a common way to represent and compile them. Unlike previous formats that only described SNNs but didn’t help run them, snn-mlir creates a shared intermediate code that works both for simulation and real hardware deployment. They also built a Python tool to convert network descriptions into this code, which can then be turned into standalone C programs that run on CPUs and embedded devices. Their work focuses on simple feedforward networks and is available open source for others to use and build on.
Spiking Neural NetworksNeuromorphic Intermediate RepresentationMLIRQuantizationIntermediate RepresentationFeedforward NetworksCompilationEmbedded SystemsLLVMC11
Authors
Alejandro García Gener, Alvaro Rollón de Pinedo
Abstract
Spiking neural networks (SNNs) are increasingly trained in a wide range of frameworks (SnnTorch, Lava, Norse, and others) each with its own model format. The Neuromorphic Intermediate Representation (NIR) addresses this fragmentation by providing a common, framework-independent format for exchanging trained SNN models. NIR solves the exchange problem, but it stops there. It provides a description of a network, not a path to running one. Each backend is still left to implement deployment on its own, with no shared, transformable compiler representation in between. This paper presents snn-mlir, an outof-tree MLIR dialect for SNNs together with a NIR-MLIR-C compilation bridge. The dialect provides a small set of typepolymorphic operations that work identically on floating-point (f32/f64) and quantized data, so a single intermediate representation serves both simulation and hardware-oriented deployment. A Python front end reads any NIR file and emits dialect IR, automatically inserting rescaling operations to keep quantization scales consistent across layers. A reference lowering pass converts the dialect to standard linalg and arith operations, from which the toolchain produces self-contained, dependency free C11 code that compiles and runs on any C-capable CPU or embedded target. We evaluate numerical fidelity against reference outputs, portability across CPU targets, and the cost of quantization. The current scope is feedforward, fully-connected networks with a CPU backend. snn-mlir is released as open source under the Apache-2.0 license with LLVM-exception and it is already available on Github.