Skip to main content
QUICK REVIEW

[论文解读] AutoPhase: Juggling HLS Phase Orderings in Random Forests with Deep Reinforcement Learning

Ameer Haj-Ali, Qijing Huang|arXiv (Cornell University)|Mar 15, 2020
Software Engineering Research被引用 16
一句话总结

AutoPhase 提出了一种深度强化学习框架,通过随机森林引导搜索空间缩减,自动确定高阶综合(HLS)编译中的最优阶段排序。该方法在仅用 100 个合成程序进行训练后,即可在多样化基准测试中有效泛化,并在性能上优于 -O3 优化,提升达 28%。

ABSTRACT

The performance of the code a compiler generates depends on the order in which it applies the optimization passes. Choosing a good order--often referred to as the phase-ordering problem, is an NP-hard problem. As a result, existing solutions rely on a variety of heuristics. In this paper, we evaluate a new technique to address the phase-ordering problem: deep reinforcement learning. To this end, we implement AutoPhase: a framework that takes a program and uses deep reinforcement learning to find a sequence of compilation passes that minimizes its execution time. Without loss of generality, we construct this framework in the context of the LLVM compiler toolchain and target high-level synthesis programs. We use random forests to quantify the correlation between the effectiveness of a given pass and the program's features. This helps us reduce the search space by avoiding phase orderings that are unlikely to improve the performance of a given program. We compare the performance of AutoPhase to state-of-the-art algorithms that address the phase-ordering problem. In our evaluation, we show that AutoPhase improves circuit performance by 28% when compared to using the -O3 compiler flag, and achieves competitive results compared to the state-of-the-art solutions, while requiring fewer samples. Furthermore, unlike existing state-of-the-art solutions, our deep reinforcement learning solution shows promising result in generalizing to real benchmarks and 12,874 different randomly generated programs, after training on a hundred randomly generated programs.

研究动机与目标

  • 为解决高阶综合(HLS)编译器中显著影响生成代码性能的 NP-难阶段排序问题。
  • 减少对基于启发式策略的阶段排序方法的依赖,这些方法通常难以在多样化程序间泛化。
  • 开发一种基于学习的方法,根据程序特定特征动态选择最优的 pass 序列。
  • 在最小化所需训练样本数量的同时,提升性能并超越现有最先进阶段排序技术。
  • 在有限训练后,评估模型在真实基准和大量随机生成程序上的泛化能力。

提出的方法

  • 利用深度强化学习,在 LLVM 工具链中学习 HLS 编译的最优阶段排序策略。
  • 采用随机森林建模程序特征与 pass 效果之间的相关性,实现高效的搜索空间剪枝。
  • 利用程序特定特征预测哪些编译 pass 可能提升性能,从而减少候选阶段排序的数量。
  • 在仅 100 个随机生成的程序上训练强化学习智能体,使其可泛化至额外的 12,874 个合成与真实基准程序。
  • 将学习到的策略集成到编译流水线中,通过自适应阶段排序最小化执行时间。

实验结果

研究问题

  • RQ1深度强化学习是否能在不依赖手工设计启发式规则的情况下,有效学习 HLS 编译中的最优阶段排序?
  • RQ2将随机森林用于基于特征的 pass 效果预测,如何提升阶段排序中的搜索效率?
  • RQ3在仅用少量合成程序训练的模型,能在多大程度上泛化至真实世界和多样化基准程序?
  • RQ4与现有最先进阶段排序技术相比,AutoPhase 在性能和样本效率方面表现如何?
  • RQ5所学习的策略是否能在各种程序类型和工作负载下实现一致的性能提升?

主要发现

  • 与默认的 -O3 编译器优化标志相比,AutoPhase 将电路性能提升了 28%。
  • 该框架在所需训练样本更少的情况下,性能与最先进阶段排序解决方案相当。
  • 仅在 100 个随机生成程序上进行训练后,AutoPhase 即可有效泛化至 12,874 个不同程序,包括真实基准。
  • 利用随机森林预测 pass 效果显著减少了搜索空间,提升了训练效率。
  • 深度强化学习策略展现出强大的泛化能力,在多样化程序场景中优于基于启发式的策略。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。