Abstract: The convolution operator is the fundamental building block of modern deep learning, yet its efficient execution on ultra-low-power edge devices remains a significant challenge. This paper explores the optimization of convolution for the GAP8 processor, a multi-core RISC-V platform designed for the Internet of Things (IoT). By transforming convolution into a General Matrix-Matrix Multiplication (GEMM) and manually orchestrating data movement across a software-managed memory hierarchy, the authors achieve significant performance gains.
Introduction
Deep learning at the edge is critical for applications requiring low latency and high privacy. However, edge devices like the GAP8 operate under extreme power constraints (milliwatts) and possess limited memory. Unlike traditional CPUs, the GAP8 lacks hardware-managed caches, instead utilizing "scratchpad" memories (L1 and L2). This architectural choice necessitates manual data management via Direct Memory Access (DMA), rendering standard libraries ineffective. The researchers set out to bridge this gap by creating a GEMM-based convolution routine specifically tailored for this software-managed memory hierarchy.
Methodology
The researchers utilize a "lowering" approach, converting 4D convolution operations into 2D GEMM using im2col and im2row techniques. A key innovation is the adoption of the B3C2A0 GEMM variant. While standard algorithms often prioritize keeping output tiles in registers, the B3C2A0 variant maintains a micro-tile of the filter matrix (A) in registers. This strategy leverages the GAP8’s specialized hardware instructions for 8-bit integer (INT8) dot products.
The implementation features a six-level nested loop structure (L1-L6) to manage tiling across the memory hierarchy. Data movement is explicitly handled by the GAP8's Fabric Controller, which coordinates DMA transfers while the eight compute cores perform arithmetic. Parallelization is applied at the L5 loop level, which iterates over micro-tiles of the filter matrix. This approach minimizes synchronization overhead and prevents memory race conditions where multiple cores might attempt to update the same address simultaneously.
Evaluation and Results
The system was evaluated using 27 convolutional layers from MobileNet-v1, utilizing INT8 quantization—the standard for edge AI. The parallel implementation achieved a maximum speedup of 5.15x for im2row and 5.00x for im2col on 8 cores compared to single-core execution. The average speedup across all layers was approximately 4.4x, with peak performance reaching roughly 247 MOPS (Millions of Operations Per Second).
Key Insights
- Scratchpads as a Double-Edged Sword: While scratchpad memories offer superior power efficiency compared to caches, they shift the burden of performance entirely to software. High efficiency is only attainable when data transfers are effectively "hidden" within the tiling logic.
- Instruction Set Synergy: The choice of the B3C2A0 variant was dictated by the RISC-V ISA extensions on the GAP8. Because the hardware specifically supports a 4-element INT8 dot product, keeping filter weights in registers proved more efficient than standard approaches.
- im2col vs. im2row: The study highlights a trade-off: while
im2colis often faster for individual layers,im2rowis more "chainable," allowing the output of one layer to be fed directly into the next without expensive memory re-arrangements.
Conclusion and Future Work
This work demonstrates that high-performance deep learning is achievable on ultra-low-power RISC-V hardware through careful algorithmic selection and manual memory management. Currently, computation and communication are not fully overlapped, leading to some core idleness. Future work will focus on implementing double buffering to further hide DMA latency and exploring additional GEMM variants to optimize end-to-end neural network execution.
Summary updated