Advanced compiler technology is crucial for enabling machine learning applications to run on novel hardware, but traditional compilers fail to deliver performance, popular auto-tuners have long search times and expert-optimized libraries introduce unsustainable costs. To address this, we developed LoopTune, a deep reinforcement learning compiler that optimizes tensor computations in deep learning models for the CPU. LoopTune optimizes tensor traversal order while using the ultra-fast lightweight code generator LoopNest to perform hardware-specific optimizations. With a novel graph-based representation and action space, LoopTune speeds up LoopNest by 3.2x, generating an order of magnitude faster code than TVM, 2.8x faster than MetaSchedule, and 1.08x faster than AutoTVM, consistently performing at the level of the hand-tuned library Numpy. Moreover, LoopTune tunes code in order of seconds.
翻译:先进的编译器技术对于让机器学习应用在新硬件上运行至关重要,但传统编译器难以实现高性能,流行的自动调优器搜索时间长,而专家优化的库则带来了不可持续的成本。为解决这一问题,我们开发了LoopTune,一种深度强化学习编译器,用于优化CPU上深度学习模型中的张量计算。LoopTune在优化张量遍历顺序的同时,利用超高速轻量级代码生成器LoopNest执行硬件特定优化。通过新颖的基于图的表示和动作空间,LoopTune将LoopNest的速度提升了3.2倍,生成的代码比TVM快一个数量级,比MetaSchedule快2.8倍,比AutoTVM快1.08倍,其性能始终与手工调优库Numpy相当。此外,LoopTune在几秒钟内即可完成代码调优。