微控制器上用于机器学习的对角存储器优化
Diagonal Memory Optimisation for Machine Learning on Micro-controllers
摘要:
随着机器学习扩展到越来越多的应用领域,微控制器和低功耗CPU越来越多地被用于利用机器学习模型执行推理。部署到这些有限的硬件目标上的能力使机器学习模型能够在各种新领域中使用。优化这些目标上的推理过程带来了与桌面CPU或GPU实现不同的挑战,其中这些目标上可用的少量RAM限制了可以执行的模型的大小。对11个机器学习模型的记忆使用模式进行了分析。使用Valgrind调试工具的修改版本观察内存加载和存储模式,识别存储器区域保存推理进行时计算所需的值。这些分析确定了通过重叠各个张量操作的输入和输出缓冲区来优化这些模型的内存使用的机会。提出了三种计算张量运算输入输出缓冲区安全重叠的方法。范围从具有对编译层操作进行操作的能力的计算昂贵的方法,到需要访问层的原始源代码的通用分析解决方案。对角线内存优化技术的描述和显示,以实现内存节省高达34.5%时,适用于11个常见的模型。微控制器的目标是确定它是唯一可能部署一些模型,如果使用对角内存优化。
英文摘要:
As machine learning spreads into more and more application areas, micro controllers and low power CPUs are increasingly being used to perform inference with machine learning models. The capability to deploy onto these limited hardware targets is enabling machine learning models to be used across a diverse range of new domains. Optimising the inference process on these targets poses different challenges from either desktop CPU or GPU implementations, where the small amounts of RAM available on these targets sets limits on size of models which can be executed. Analysis of the memory use patterns of eleven machine learning models was performed. Memory load and store patterns were observed using a modified version of the Valgrind debugging tool, identifying memory areas holding values necessary for the calculation as inference progressed. These analyses identified opportunities optimise the memory use of these models by overlapping the input and output buffers of individual tensor operations. Three methods are presented which can calculate the safe overlap of input and output buffers for tensor operations. Ranging from a computationally expensive approach with the ability to operate on compiled layer operations, to a versatile analytical solution which requires access to the original source code of the layer. The diagonal memory optimisation technique is described and shown to achieve memory savings of up to 34.5% when applied to eleven common models. Micro-controller targets are identified where it is only possible to deploy some models if diagonal memory optimisation is used.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。