Abstract
NeoCPU is a full-stack optimization framework designed to bridge the gap between deep learning frameworks and hardware-specific libraries. By replacing rigid, third-party kernels with flexible templates and implementing a global search for optimal data layouts, NeoCPU enables joint optimization across the entire computation graph. Experimental results demonstrate significant performance gains, achieving up to 3.45× faster inference on ARM architectures compared to state-of-the-art baselines.
Introduction
While GPUs dominate the training landscape, CPUs remain essential for diverse real-world deployments, from cloud servers to edge devices. However, current CPU inference often suffers from "sub-optimal by design" architectures. Standard frameworks like TensorFlow and MXNet rely on "black box" libraries (e.g., Intel MKL-DNN) with pre-baked kernels. This dependency forces frequent and costly layout transformations as data moves between layers, creating a significant performance bottleneck.
Methodology
NeoCPU addresses these inefficiencies through a full-stack approach that integrates kernel-level and graph-level optimizations.
Operation Templates and Vectorization
Instead of relying on assembly-coded libraries, NeoCPU utilizes high-level language templates for operations such as convolution (CONV). These templates are highly configurable, allowing for fine-tuning of blocking sizes and loop unrolling to match specific CPU architectures (x86, ARM) without manual code rewrites.
Layout Transformation Elimination
NeoCPU categorizes operations based on their layout sensitivity: layout-oblivious (e.g., ReLU), layout-tolerant (e.g., CONV), and layout-dependent (e.g., Flatten). The framework aims to maintain data in an optimized, "blocked" format (e.g., $NCHW[x]c$) throughout the graph, minimizing expensive reshuffling.
Two-Stage Optimization Search
The framework employs a dual-layered search strategy:
- Local Search: Optimizes individual operation parameters (e.g., tile sizes) for the target hardware.
- Global Search: Uses Dynamic Programming or a heuristic solver (PBQP) to determine the best combination of layouts across the entire network. This global perspective allows the system to choose a slightly slower kernel if it prevents a more costly data transformation later in the pipeline.
Custom Thread Pool
To mitigate overhead and resource contention typical of standard multi-threading tools like OpenMP, NeoCPU implements a lightweight, custom thread pool. This pool is specifically designed for the parallel nature of CNNs, utilizing strict thread binding to ensure stability and performance.
Experimental Evaluation
The researchers evaluated NeoCPU using 15 popular CNN models, including various versions of ResNet, VGG, DenseNet, and Inception-v3. Testing spanned three hardware platforms: Intel Skylake (AVX-512), AMD EPYC (AVX2), and ARM Cortex A72 (NEON).
Key Results
NeoCPU consistently outperformed established baselines:
- Performance Gains: Speedups reached 0.94–1.15× on Intel, 0.92–1.72× on AMD, and 2.05–3.45× on ARM.
- Latency Reduction: On an 18-core Intel Skylake, ResNet-50 latency was reduced to 5.73ms, significantly lower than MXNet (6.60ms) and TensorFlow (11.93ms).
- Scalability: The custom thread pool demonstrated superior linear scaling compared to OpenMP, particularly on high-core-count processors like the 24-core AMD EPYC.
Conclusion and Future Work
NeoCPU demonstrates that a framework-agnostic, full-stack approach can significantly enhance CPU inference performance. By breaking the "black box" of hardware libraries, it achieves a level of joint optimization previously unavailable. Future research will focus on expanding the kernel scope to include Winograd and FFT-based convolutions, implementing 8-bit integer (INT8) quantization for edge devices, and addressing the challenges of dynamic input shapes.
Summary updated