基于虚拟化张量的边缘深度学习训练 GPU 内存管理
vTensor-Based GPU Memory Management for Edge Deep Learning Training
-
摘要:研究背景 边缘深度学习训练随着对于隐私与安全因素的考量,逐渐成为深度学习训练的趋势。但是,边缘服务器搭载的 GPU 内存容量不足,难以有效支撑资源密集型的深度学习训练,导致深度学习训练因内存不足而失败。深度学习框架开始集成内存交换机制,通过在GPU内存— CPU内存间周期性交换内存数据(tensor,张量,即深度学习训练特征图,权重等数据),保障深度学习训练运行。但当前的内存交换机制由于采用基于张量的内存管理,内存交换数据量与内存需求不匹配,导致显著的性能下降。目的 本研究面向深度学习框架提供细粒度内存管理支持,降低内存交换机制的运行开销。本研究构建细粒度内存管理架构,并基于这一架构构建决策算法,高效发现内存交换需求,准确指定内存交换粒度,实现内存交换粒度与内存交换需求的一致,保障深度学习训练性能。方法 本研究提出细粒度的、基于虚拟化张量(vTensor)的内存管理方案以降低内存交换开销。本研究构造张量虚拟化层,以用户透明的方式将张量(tensor)虚拟化至一系列vTensor,通过本研究定义的split,salloc与merge原语,对vTensor独立进行管理,响应实时内存需求。本研究随后构建层次图模型(Layered Graph Model,LGM),通过刻画深度学习训练阶段的内存分配过程,为张量确定虚拟化张量的映射方案。此外,层次图模型引入内存预留机制,以避免过小交换粒度对内存交换效率的影响,最终保障基于vTensor的内存交换粒度与内存交换需求的一致,保障内存交换效率。结果 本研究在一系列典型边缘深度学习模型上进行验证。本研究基于 vTensor的内存管理方案与现有方案相比,具有 15.60% 的性能提升。本研究的张量虚拟化层可以高效进行虚拟化张量映射与管理,运行开销可忽略不计。本研究对于层次图模型,以及其内部的内存预留机制分别验证了其有效性。结论 基于虚拟化张量的动态GPU内存管理可以应对因深度学习训练内存管理低效导致的性能降级问题。通过利用典型边缘模型中的张量分布特征,本研究构建张量虚拟化层实现张量到一系列虚拟化张量的映射,并提供split、salloc与merge原语对其进行有效的管理,以对于内存交换粒度与内存交换需求。本研究进一步通过构建层次图模型进行离线分析,分析虚拟化张量的内存布局确定其交换与被交换关系,并通过内存预留避免过小交换,最终可以为张量形成虚拟化张量映射与交换方案。本研究验证结果表示其与现有方案相比,具有15.60% 的性能提升。Abstract: Supporting real-time and privacy-preserving learning at the edge is emerging as a critical trend, bringing forth substantial challenges for deep learning (DL) training in the context of limited GPU (graphic processing unit) memory. Recent work has sought to address the limitations by swapping tensors between GPU memory and CPU memory. Unfortunately, their tensor-based memory management encounters additional overhead since the swapped tensors do not align with the actual memory demands, resulting in decreased throughput. This paper introduces a vTensor-based memory management approach designed to mitigate memory swapping overhead. Virtualized tensors, dubbed vTensors, are used to finely align memory swapping amounts with real-time memory demands. Firstly, we introduce an abstraction layer that virtualizes coarse-grained tensors to multiple finer-grained vTensors. Secondly, we propose the Layered Graph Model (LGM) for analyzing vTensor mappings, which produces a memory swapping plan leveraged in the subsequent DL training iterations. Evaluations conducted on typical edge deep learning models illustrate that our approach surpasses prior work with a 15.60% increase in DL training throughput.
下载: