[论文解读] Optimizing CNN Model Inference on CPUs
NeoCPU 提供一个框架,在没有第三方库的情况下对 CPU 上的 CNN 推理进行端到端优化,相较于最先进方法实现高达 3.45x 的延迟降低。它在 x86 和 ARM 架构上执行操作级和图级优化,并作为 TVM 的一部分开源。
The popularity of Convolutional Neural Network (CNN) models and the ubiquity of CPUs imply that better performance of CNN model inference on CPUs can deliver significant gain to a large number of users. To improve the performance of CNN inference on CPUs, current approaches like MXNet and Intel OpenVINO usually treat the model as a graph and use the high-performance libraries such as Intel MKL-DNN to implement the operations of the graph. While achieving reasonable performance on individual operations from the off-the-shelf libraries, this solution makes it inflexible to conduct optimizations at the graph level, as the local operation-level optimizations are predefined. Therefore, it is restrictive and misses the opportunity to optimize the end-to-end inference pipeline as a whole. This paper presents \emph{NeoCPU}, a comprehensive approach of CNN model inference on CPUs that employs a full-stack and systematic scheme of optimizations. \emph{NeoCPU} optimizes the operations as templates without relying on third-parties libraries, which enables further improvement of the performance via operation- and graph-level joint optimization. Experiments show that \emph{NeoCPU} achieves up to 3.45$ imes$ lower latency for CNN model inference than the current state-of-the-art implementations on various kinds of popular CPUs.
研究动机与目标
- 由于通用 CPU 的广泛部署以及服务器、边缘与客户端设备中 CNN 使用的上升,推动高效 CNN 推理。
- 提出一个结合操作级和图级优化、不依赖第三方库的框架。
- 展示在多种 CPU 架构(x86 和 ARM)上的端到端优化。
- 展示联合布局和操作模板化在端到端性能上优于现有解决方案。
提出的方法
- 将 NeoCPU 开发为一个全栈、基于模板的卷积(CONV)实现,利用 SIMD/FMA 而无需第三方内核。
- 引入一个图级优化,通过在可能的情况下在 CONV 层之间保持优化的 NCHW[x]c 布局,来消除不必要的数据布局转换。
- 实现两阶段优化方案搜索:局部的每个 CONV 调度搜索和全局的基于 DP 的图级搜索或 PBQP 近似搜索,以选择端到端布局。
- 与 TVM 集成,以实现自有操作模板和图级优化,同时在编译时对不变内核权重进行预变换。
- 在多家 CPU 厂商上,与框架基础 (MXNet/TensorFlow) 和框架无关的基线(OpenVINO)进行对比。
实验结果
研究问题
- RQ1在不依赖第三方高性能库的情况下,CPU 上的端到端 CNN 推理是否能显著加速?
- RQ2联合操作级和图级优化对不同 CPU 架构的端到端延迟有何影响?
- RQ3数据布局管理(NCHW[x]c)和布局转换如何影响整体性能和开销?
- RQ4局部与全局优化搜索在实现接近最佳端到端性能方面的有效性如何?
主要发现
- NeoCPU 在各种 CPU 上的 CNN 模型推理相对于当前最先进实现实现了最多 3.45x 的更低延迟。
- 在 Intel Skylake 上对 13/15 网络提供高性能,在 AMD EYPC 上为 14/15,在 ARM Cortex-A72 CPU 上为所有 15。
- 生成了一个独立的、与框架无关的模块,依赖 footprint 最小,便于在各平台部署。
- 该方法的开源发布与 TVM 项目集成,促进更广泛的采用。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。