Abstract
Lightweight neural networks, such as MobileNets, rely heavily on Depthwise (DWConv) and Pointwise (PWConv) convolutions to achieve efficiency on mobile hardware. However, existing libraries like TensorFlow Lite and compilers like TVM often fail to reach the peak performance potential of ARM-based processors. This paper identifies a critical bottleneck in "Arithmetic Intensity"—the data traffic between CPU registers and cache—and proposes optimized implementation strategies. By employing loop rescheduling for DWConv and a novel "Reuse block D" (RTRD) strategy for PWConv, the authors achieve speedups of up to 5.5× for DWConv and 2.1× for PWConv, pushing performance remarkably close to the hardware's theoretical roofline.
Introduction: The Arithmetic Intensity Bottleneck
While traditional optimization focuses on the "Roofline Model"—minimizing traffic between main memory and cache—ARM-based mobile processors present a distinct challenge. Unlike many x86 architectures that can load multiple registers from cache per cycle, ARM processors are typically limited to a single load. This architectural constraint means that even if data is perfectly cached, the program can still be bottlenecked by the bandwidth between the cache and the CPU registers.
The authors define this as a shift from "Operational Intensity" to "Arithmetic Intensity." Existing implementations often suffer from high register-cache traffic or poor multi-core scalability due to "cache thrashing," where multiple cores compete for the same L1 cache resources, leading to stalled performance.
Optimization Methods
Depthwise Convolution (DWConv)
Depthwise convolution is often memory-bound. To address this, the authors propose two main techniques:
- Loop Rescheduling for Scalability: Standard implementations often parallelize across the spatial height of an image. On multi-core systems, this forces every core to load the entire set of filters into its local L1 cache, leading to redundant cache usage. By parallelizing across the channel dimension instead, each core handles only a fraction of the filters, significantly reducing the cache footprint and improving multi-core efficiency.
- Register Tiling: To minimize load/store instructions, the implementation keeps small "tiles" of the output feature map in registers as long as possible. By loading a filter once and reusing it across multiple spatial locations within the registers, the arithmetic intensity is maximized.
Pointwise Convolution (PWConv)
Pointwise convolution is essentially a matrix multiplication (MM) task. Traditional BLAS libraries use a "Reuse block A" (RTRA) strategy, which focuses on reusing input data. However, given ARM's limited load bandwidth, the authors propose a "Reuse block D" (RTRD) strategy. In RTRD, the output block (D) is kept in the registers while the input and filter data are streamed through. Since updating the output requires both a load and a store operation, keeping it in registers is more efficient than repeatedly swapping it out for input data.
Experimental Results
The proposed methods were evaluated on an ARM Cortex-A57 quad-core processor using layers extracted from MobileNetV1, MobileNetV2, and MnasNet-A1.
As shown in Figure 5, the optimized DWConv implementation achieves up to a 5.5× speedup over TVM and a 9.0× speedup over unoptimized baselines. For PWConv, the implementation outperforms both TVM and TF-Lite (using Ruy or OpenBLAS) by up to 2.1×.
Furthermore, the implementation demonstrates excellent scalability. When scaling from one to four threads, it achieves near-linear speedup (up to 3.9×), whereas TF-Lite's performance often plateaus due to cache contention. For a full MobileNetV1 model, the system reached a throughput of 46 GFlops, placing it very close to the hardware's theoretical peak performance as illustrated in the roofline analysis in Figure 1.
Conclusion
This research highlights that manual architectural insight remains crucial for extracting peak performance from mobile hardware. By focusing on register-level traffic and cache-aware parallelization, the authors significantly improved the efficiency of the most common layers in lightweight neural networks. While these optimizations were manually tuned for AArch64, the underlying strategies provide a blueprint for future compiler development, potentially allowing frameworks like TVM to automate these high-performance gains across a broader range of models and hardware architectures.
Summary updated