Abstract
Deep Neural Networks are becoming increasingly popular in always-on IoT edge devices performing data analytics right at the source, reducing latency as well as energy consumption for data communication. This paper presents CMSIS-NN, efficient kernels developed to maximize the performance and minimize the memory footprint of neural network (NN) applications on Arm Cortex-M processors targeted for intelligent IoT edge devices. Neural network inference based on CMSIS-NN kernels achieves 4.6X improvement in runtime/throughput and 4.9X improvement in energy efficiency.
Introduction
The proliferation of the Internet of Things (IoT) is driving a shift from cloud-centric processing to edge computing. With a projected trillion connected devices, transmitting raw sensor data to the cloud is increasingly impractical due to bandwidth constraints, latency requirements, and privacy concerns. Performing neural network inference directly on edge devices—typically powered by microcontrollers (MCUs) like the Arm Cortex-M series—offers a solution. However, these devices face severe resource constraints, often possessing only kilobytes of memory and lacking the specialized hardware accelerators found in higher-end systems. CMSIS-NN addresses these challenges by providing a library of optimized software kernels tailored for the architectural constraints of low-power MCUs.
Implementation and Optimization
CMSIS-NN is designed to bridge the gap between high-level neural network descriptions and low-level hardware execution. The library is organized into core functions and support utilities to facilitate efficient data handling and computation.
Fixed-Point Quantization
To minimize memory usage and computational complexity, CMSIS-NN utilizes 8-bit (q7_t) and 16-bit (q15_t) fixed-point quantization instead of 32-bit floating-point arithmetic. This approach reduces the memory footprint for weights and activations by a factor of four. Furthermore, by using power-of-two scaling, the library replaces expensive division operations with efficient bitwise shifts, enabling high performance even on MCUs without a dedicated Floating Point Unit (FPU).
SIMD Utilization and Matrix Multiplication
A core optimization in CMSIS-NN is the use of Single Instruction, Multiple Data (SIMD) instructions. For processors like the Cortex-M7, the library leverages 16-bit Multiply-and-Accumulate (MAC) instructions, such as SMLAD. This allows the CPU to perform two 16-bit multiplications and an accumulation in a single clock cycle, significantly boosting throughput for convolution and fully-connected layers.
Memory Management: Partial im2col and HWC Layout
Standard convolution often relies on the im2col (image-to-column) technique, which transforms convolution into matrix multiplication but requires significant memory buffers. CMSIS-NN introduces a partial im2col strategy, expanding only a limited number of columns at a time to balance speed and memory footprint. Additionally, the library adopts a "Channel-Last" (Height-Width-Channel or HWC) data layout. This ensures that data along the channel dimension is contiguous in memory, facilitating efficient loading into SIMD registers.
Results and Evaluation
The performance of CMSIS-NN was evaluated using the CIFAR-10 dataset on an Arm Cortex-M7 platform running at 216 MHz. The 8-bit quantized model achieved an accuracy of 79.9%, nearly matching the 80.3% accuracy of the original floating-point model.
Key performance metrics include:
- Throughput: The optimized kernels enabled a classification rate of 10.1 images per second.
- Efficiency: Compared to the standard CMSIS-DSP library, CMSIS-NN delivered a 4.6x improvement in runtime and a 4.9x improvement in energy efficiency.
- Memory Footprint: The use of partial
im2colreduced the required memory from approximately 332 KB to 133 KB, enabling the model to fit within the constraints of typical MCU on-chip memory.
Conclusion
CMSIS-NN demonstrates that with careful hardware-software co-design, sophisticated deep learning models can be deployed on resource-constrained microcontrollers. By leveraging fixed-point quantization, SIMD instructions, and innovative memory management techniques, CMSIS-NN makes "always-on" AI a reality for the next generation of intelligent IoT edge devices. Future work involves further automating the integration process and expanding support for a wider variety of network topologies and lower-end MCU cores.
Summary updated