arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.20037cs.LGcs.PL
收藏

如风暴般探索,如雨滴般利用:论用坐标下降微调内核调度器的益处

Explore as a Storm, Exploit as a Raindrop: On the Benefit of Fine-Tuning Kernel Schedulers with Coordinate Descent

UFMG(米纳斯吉拉斯联邦大学);Stony Brook University(石溪大学)

Michael Canesche, Gaurav Verma, Fernando Magno Quintao Pereira

AI总结:

本研究将Droplet Search引入Ansor的探索阶段,通过限制探索样本数、选优后用坐标下降利用的方式,在更短时间内得到更优内核,且该方法通用性已得到验证。

摘要:

机器学习模型由内核(kernel)构成,内核是对张量——即由自然数的线性组合索引的数据——执行运算的算法。内核的例子包括卷积、转置和向量积。内核的实现方式有很多种,这些实现构成了内核的优化空间。内核调度是指在给定目标函数(通常是执行速度)的情况下,寻找最优实现的问题。Ansor、Halide和AutoTVM等内核优化器通过搜索启发式方法解决这一问题,这类方法结合了两个阶段:探索与利用。第一阶段评估大量不同的内核优化空间,第二阶段则通过研究同一空间内的内核,尝试优化最优实现。例如,Ansor结合了基于草图(sketch)的内核生成来完成探索,并利用进化算法来利用最优草图。在本研究中,我们证明了将Droplet Search(一种AutoTVM算法)引入Ansor的探索阶段,有望在提升内核质量的同时缩短Ansor的搜索时间。该方法的思路是限制Ansor探索的样本数量,选出最优样本,再用坐标下降算法对其进行利用。将该方法应用于Ansor生成的前300个内核时,我们通常能在更短的时间内得到比让Ansor分析10000个内核更优的内核。这一结果已在20个知名深度学习模型(AlexNet、ResNet、VGG、DenseNet等)上得到复现,测试运行在四种架构上:AMD Ryzen 7(x86)、NVIDIA A100张量核心、NVIDIA RTX 3080 GPU和ARM A64FX。包含该组合方法的补丁已于2024年2月在Ansor中获批。作为该搜索方法通用性的证明,一个取得了同等优异结果的类似补丁已于2024年6月提交给TVM的MetaSchedule。

英文摘要:

Machine-learning models consist of kernels, which are algorithms applying operations on tensors -- data indexed by a linear combination of natural numbers. Examples of kernels include convolutions, transpositions, and vectorial products. There are many ways to implement a kernel. These implementations form the kernel's optimization space. Kernel scheduling is the problem of finding the best implementation, given an objective function -- typically execution speed. Kernel optimizers such as Ansor, Halide, and AutoTVM solve this problem via search heuristics, which combine two phases: exploration and exploitation. The first step evaluates many different kernel optimization spaces. The latter tries to improve the best implementations by investigating a kernel within the same space. For example, Ansor combines kernel generation through sketches for exploration and leverages an evolutionary algorithm to exploit the best sketches. In this work, we demonstrate the potential to reduce Ansor's search time while enhancing kernel quality by incorporating Droplet Search, an AutoTVM algorithm, into Ansor's exploration phase. The approach involves limiting the number of samples explored by Ansor, selecting the best, and exploiting it with a coordinate descent algorithm. By applying this approach to the first 300 kernels that Ansor generates, we usually obtain better kernels in less time than if we let Ansor analyze 10,000 kernels. This result has been replicated in 20 well-known deep-learning models (AlexNet, ResNet, VGG, DenseNet, etc.) running on four architectures: an AMD Ryzen 7 (x86), an NVIDIA A100 tensor core, an NVIDIA RTX 3080 GPU, and an ARM A64FX. A patch with this combined approach was approved in Ansor in February 2024. As evidence of the generality of this search methodology, a similar patch, achieving equally good results, was submitted to TVM's MetaSchedule in June 2024.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑