Abstract
We address the efficient implementation of the convolution operator on the GAP8 parallel ultra-low-power platform (PULP), a heterogeneous multi-core processor equipped with a fabric controller (FC); a cluster of eight compute cores; and a four-level memory hierarchy with scratchpads instead of conventional, hardware-assisted cache memories. Our solution for this platform transforms the convolution into a general matrix-matrix multiplication (GEMM) via the lowering approach, demonstrating that it is possible to attain reasonable performance on the GAP8 by carefully adapting techniques such as tiling and loop parallelism, which are mainstream in the multi-threaded, cache-aware realization of GEMM.
Introduction
Deep learning at the "edge"—on tiny, battery-powered devices—is notoriously difficult. Standard processors rely on hardware-assisted caches to manage data, but ultra-low-power chips like the GAP8 use scratchpad memories. These are faster and more energy-efficient but require the programmer to manually move every byte of data using Direct Memory Access (DMA) controllers.
The challenge is twofold: mapping 4D convolution operations onto 2D matrix multiplications (GEMM) efficiently and keeping eight compute cores busy while a single "Fabric Controller" (FC) manages the complex dance of data moving between three levels of memory (L1, L2, and L3).
Methods and Parallelization Strategy
The researchers employed a "lowering" approach, using two primary transformations: IM2COL and IM2ROW. These techniques "flatten" input tensors and filters into matrices, allowing the use of highly optimized GEMM kernels. Instead of a standard GEMM, they used a specific algorithmic variant (B3C2A0) tailored for the GAP8. This version favors streaming data directly into registers, which aligns with the GAP8’s specialized hardware support for 4-element 8-bit integer (INT8) dot products.
As shown in the hierarchical loop structure, the parallelization strategy focuses on the "outer" loops of the GEMM (specifically Loop L5). This allows the eight compute cores to work on independent "chunks" of the output matrix while sharing buffers in the L1 and L2 scratchpads. The Fabric Controller (FC) acts as a conductor, pre-fetching data from the large L3 memory into the smaller L2 and L1 scratchpads so the compute cores never have to wait.
Key Insights: Software-Managed Memory and Packing
On edge devices, performance is dictated by memory management. By manually managing the scratchpads, the authors ensured "unit stride" access—reading data in a continuous line—which is essential for performance.
A critical optimization was "pre-packing" filter weights. Since weights are constant during inference, pre-arranging them into a specific memory layout saves significant execution time. Furthermore, the GAP8's specialized instruction for computing dot products of four INT8 values in a single cycle was leveraged by designing a micro-kernel specifically to feed this hardware unit.
Results and Evaluation
The approach was evaluated using the convolutional layers of MobileNet-v1, a standard benchmark for mobile vision models. Testing across all 27 layers revealed:
- Peak Performance: On a single core, the optimized GEMM reached a sustained peak of 247 MOPS (Millions of Operations per Second).
- Scalability: Moving from one core to eight yielded a speedup of up to 5.0x for
im2coland 5.15x forim2row. - Efficiency: The
im2colvariant generally outperformedim2rowfor initial layers due to pre-packing, whileim2rowproved theoretically better for "chaining" multiple layers without data re-ordering.
Conclusion
This work demonstrates that high-performance deep learning inference is achievable on ultra-low-power RISC-V hardware through meticulous software-managed memory orchestration. While the current system performs data transfers and computation sequentially, future work will explore double buffering to further hide DMA latency and optimize the im2row variant to match the performance gains seen with im2col.
Summary updated