通过细粒度协同计算,显著加速移动端模型推理。
Accelerating Mobile Inference through Fine-Grained CPU-GPU Co-Execution
- 利用OpenCL共享虚拟内存实现轻量级同步,降低通信开销。
- 用机器学习预测任务执行时间,实现1.89倍线性层加速。
- 适合追求低延迟的移动端深度学习部署开发者。
在移动设备上部署深度神经网络日益重要,但受限于计算资源仍具挑战。其统一内存架构及CPU与GPU性能差距缩小,为同时调度两者以降低推理延迟提供了可能。主要障碍在于合并部分结果所需显著的同步开销,以及难以预测分配至CPU和GPU的任务执行时间(因实现方式和并行度动态选择)。为此,我们提出基于OpenCL细粒度共享虚拟内存的轻量级同步机制,以及准确预测执行时间的机器学习模型,该模型捕捉了GPU内核性能特征并考虑其调度时间。在四个移动平台上的综合评估显示,该方法可快速选择最优的CPU-GPU协同执行策略,在线性层上实现最高1.89倍加速,卷积层达1.75倍加速(接近在Pixel 5上穷举搜索所得最大值2.01倍和1.87倍)。
原文摘要 · Abstract (English)
Deploying deep neural networks on mobile devices is increasingly important but remains challenging due to limited computing resources. On the other hand, their unified memory architecture and narrower gap between CPU and GPU performance provide an opportunity to reduce inference latency by assigning tasks to both CPU and GPU. The main obstacles for such collaborative execution are the significant synchronization overhead required to combine partial results, and the difficulty of predicting execution times of tasks assigned to CPU and GPU (due to the dynamic selection of implementations and parallelism level). To overcome these obstacles, we propose both a lightweight synchronization mechanism based on OpenCL fine-grained shared virtual memory (SVM) and machine learning models to accurately predict execution times. Notably, these models capture the performance characteristics of GPU kernels and account for their dispatch times. A comprehensive evaluation on four mobile platforms shows that our approach can quickly select CPU-GPU co-execution strategies achieving up to 1.89x speedup for linear layers and 1.75x speedup for convolutional layers (close to the achievable maximum values of 2.01x and 1.87x, respectively, found by exhaustive grid search on a Pixel~5 smartphone).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。