ML/DL模型中数据流图的自动任务并行化
Automatic Task Parallelization of Dataflow Graphs in ML/DL models
AI总结:
针对现有ML/DL模型并行化技术在低批量推理、边缘设备场景下成本高、难适用的问题,提出基于关键路径的线性聚类任务并行化方法,搭配Ramiel工具将ONNX模型转为并行Pytorch代码,最高实现1.9倍加速,轻量适配资源受限设备。
摘要:
目前已有多种方法可加速机器学习(ML)或深度学习(DL)模型的训练与推理性能。然而,依赖各类图与算子并行化方法的现代技术需要进行搜索空间优化,这在功耗与硬件使用方面成本高昂。尤其在推理场景下,当批量大小为1且在CPU上执行,或是针对功耗受限的边缘设备时,现有技术可能成本过高、过于复杂甚至无法适用。为改善这一问题,我们提出一种基于关键路径的线性聚类方法,用以挖掘ML数据流图中固有的并行路径。我们的任务并行化方法还通过克隆进一步优化图结构,并通过常量传播与死代码消除对图进行剪枝。与其他研究不同的是,我们通过自主开发的名为Ramiel的新工具,将ONNX格式的输入ML模型转换为可读且可执行的并行Pytorch+Python代码。这使我们能够受益于其他下游加速技术,例如算子内并行化,以及潜在的流水线并行化。我们在多个ML图上的初步结果显示,该方法相比串行执行最高可实现1.9倍的加速,并且在编译时间与运行时间上均优于部分现有机制。最后,我们的方法足够轻量且快速,能够有效应用于功耗与资源受限的设备,同时仍支持后续的优化操作。
英文摘要:
Several methods exist today to accelerate Machine Learning(ML) or Deep-Learning(DL) model performance for training and inference. However, modern techniques that rely on various graph and operator parallelism methodologies rely on search space optimizations which are costly in terms of power and hardware usage. Especially in the case of inference, when the batch size is 1 and execution is on CPUs or for power-constrained edge devices, current techniques can become costly, complicated or inapplicable. To ameliorate this, we present a Critical-Path-based Linear Clustering approach to exploit inherent parallel paths in ML dataflow graphs. Our task parallelization approach further optimizes the structure of graphs via cloning and prunes them via constant propagation and dead-code elimination. Contrary to other work, we generate readable and executable parallel Pytorch+Python code from input ML models in ONNX format via a new tool that we have built called {\bf Ramiel}. This allows us to benefit from other downstream acceleration techniques like intra-op parallelism and potentially pipeline parallelism. Our preliminary results on several ML graphs demonstrate up to 1.9$\times$ speedup over serial execution and outperform some of the current mechanisms in both compile and runtimes. Lastly, our methods are lightweight and fast enough so that they can be used effectively for power and resource-constrained devices, while still enabling downstream optimizations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。