Skip to main content
QUICK REVIEW

[论文解读] AutoPhase: Compiler Phase-Ordering for High Level Synthesis with Deep Reinforcement Learning

Ameer Haj-Ali, Qijing Huang|arXiv (Cornell University)|Jan 15, 2019
Evolutionary Algorithms and Applications参考文献 24被引用 4
一句话总结

该论文提出 AutoPhase,一种基于深度强化学习的框架,用于在高层次综合(HLS)中优化编译器阶段排序,以提升电路性能。通过在 LLVM IR 特征上使用 DQN 和策略梯度算法,AutoPhase 在 1-2 个数量级内实现比 -O3 快 100 倍的搜索速度,性能提升达 16%,显著优于传统方法。

ABSTRACT

The performance of the code generated by a compiler depends on the order in which the optimization passes are applied. In high-level synthesis, the quality of the generated circuit relates directly to the code generated by the front-end compiler. Choosing a good order--often referred to as the phase-ordering problem--is an NP-hard problem. In this paper, we evaluate a new technique to address the phase-ordering problem: deep reinforcement learning. We implement a framework in the context of the LLVM compiler to optimize the ordering for HLS programs and compare the performance of deep reinforcement learning to state-of-the-art algorithms that address the phase-ordering problem. Overall, our framework runs one to two orders of magnitude faster than these algorithms, and achieves a 16% improvement in circuit performance over the -O3 compiler flag.

研究动机与目标

  • 为解决高层次综合(HLS)中 NP-难的阶段排序问题,其中优化阶段的顺序对电路性能有决定性影响。
  • 探索深度强化学习是否能在寻找最优阶段序列方面超越传统启发式和遗传算法。
  • 开发一种框架,学习高效的阶段排序策略,且在新程序上仅需极少重训练。
  • 评估在 HLS 优化背景下,性能提升与训练/推理效率之间的权衡。

提出的方法

  • 从 LLVM IR 提取 56 个静态特征,包括基本块数量、分支数量以及指令类型频率,以表示程序状态。
  • 将状态表示为原始特征向量或先前应用的优化阶段的直方图。
  • 使用 DQN 和策略梯度算法训练深度强化学习智能体,学习最大化电路性能的阶段排序策略。
  • 使用 LegUp HLS 分析器报告的时钟周期数作为策略优化的奖励信号。
  • 在 CHstone 和 LegUp 示例中的 12 个 HLS 基准测试上评估该框架,序列长度分别为 3、12、24,以评估可扩展性。
  • 将基于强化学习的方法与随机搜索、贪心算法、遗传算法以及 -O3 编译器标志进行对比。

实验结果

研究问题

  • RQ1深度强化学习能否有效学习 HLS 工作负载的最优编译器阶段排序序列?
  • RQ2基于强化学习的阶段排序在电路加速方面与最先进的遗传算法和贪心启发式算法相比表现如何?
  • RQ3在 HLS 阶段排序中使用强化学习时,训练时间与优化质量之间的权衡如何?
  • RQ4训练好的强化学习智能体能否在极少重训练的情况下泛化到不同 HLS 程序?
  • RQ5当应用的优化阶段数量超过某一临界点后,性能提升是否呈现收益递减?

主要发现

  • AutoPhase 在性能上相比 -O3 编译器标志实现了 16% 的提升,证明了显著的优化收益。
  • 该框架的运行速度比遗传算法和其他最先进的方法快一到两个数量级。
  • 当序列长度从 12 增加到 24 时,性能提升微乎其微,表明收益递减。
  • 强化学习方法在性能上匹配或超过遗传算法,同时训练和执行速度显著更快。
  • 训练好的强化学习智能体展现出泛化潜力,可实现对新程序的快速优化,且仅需极少重训练。

更好的研究,从现在开始

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

无需绑定信用卡

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