Reinforcement Learning Strategies for Compiler Optimization in High level Synthesis

Reinforcement Learning Strategies for Compiler Optimization in High level Synthesis
复制标题

DOI:
10.1109/llvm-hpc56686.2022.00007
复制
发表时间:
2022-11
期刊:
2022 IEEE/ACM Eighth Workshop on the LLVM Compiler Infrastructure in HPC (LLVM-HPC)
影响因子:
--
通讯作者:
Hafsah Shahzad;A. Sanaullah;Sanjay Arora;Robert Munafo;Xiteng Yao;Ulrich Drepper;M. Herbordt
Hafsah Shahzad;A. Sanaullah;Sanjay Arora;Robert Munafo;Xiteng Yao;Ulrich Drepper;M. Herbordt
中科院分区:
其他
文献类型:
--
作者:
Hafsah Shahzad;A. Sanaullah;Sanjay Arora;Robert Munafo;Xiteng Yao;Ulrich Drepper;M. Herbordt

文献摘要

相似文献

高级综合(HLS)通过自动编译CPU代码以定制硬件配置为FPGA提供了一种可能的可编程解决方案,但目前提供的硬件质量远远低于使用硬件描述语言(HDL)编写的电路。一个原因是因为CPU编译器使用的标准代码优化集(如LLVM)不太适合FPGA后端。代码性能在很大程度上受到应用传递的顺序的影响。同样,找到要应用的合理的遍数和最佳遍数参数值也是必要的。为了弥合手动调优和自动生成硬件之间的差距,因此确定HLS编译的最佳遍数序列是很重要的,这在不同的工作负载之间可能会有很大的变化。机器学习(ML)提供了一种流行的方法来自动寻找最佳编译器通道,但需要选择正确的方法。监督ML并不理想,因为它需要将标记数据映射到最佳(或接近最佳)的通道序列,这在计算上是禁止的。无监督ML技术没有考虑到需要最大化表示性能的数量的要求。强化学习,它代表了在不需要标记数据的情况下最大化长期回报的问题,以前曾被用于此类规划问题。虽然一般来说,沿着这些路线为编译器做了沿着许多工作,但针对HLS的工作是有限和保守的。在本文中,我们通过扩展HLS编译器调整的学习策略数量和用于评估其影响的指标来解决这些限制。我们的结果显示,评估的每个标准基准和调查的学习质量指标都比最新技术水平有所改进。选择正确的策略可以在学习速度上提高23倍,在性能潜力上提高4倍,在加速比上提高3倍,并且有可能在很大程度上消除最终结果中的波动带。这项工作为高效的推荐系统提供了基础,使开发人员能够根据他们的目标选择最佳的强化学习训练选项。
High Level Synthesis (HLS) offers a possible programmability solution for FPGAs by automatically compiling CPU codes to custom hardware configurations, but currently delivers far lower hardware quality than circuits written using Hardware Description Languages (HDLs). One reason is because the standard set of code optimizations used by CPU compilers, such as LLVM, are not well suited for a FPGA back end. Code performance is impacted largely by the order in which passes are applied. Similarly, it is also imperative to find a reasonable number of passes to apply and the optimum pass parameter values. In order to bridge the gap between hand tuned and automatically generated hardware, it is thus important to determine the optimal sequence of passes for HLS compilations, which could vary substantially across different workloads. Machine learning (ML) offers one popular approach to automate finding optimal compiler passes but requires selecting the right method. Supervised ML is not ideal since it requires labeled data mapping workload to optimal (or close to optimal) sequence of passes, which is computationally prohibitive. Unsupervised ML techniques don’t take into account the requirement that a quantity representing performance needs to be maximized. Reinforcement learning, which represents the problem of maximizing longterm rewards without requiring labeled data has been used for such planning problems before. While much work has been done along these lines for compilers in general, that directed towards HLS has been limited and conservative. In this paper, we address these limitations by expanding both the number of learning strategies for HLS compiler tuning and the metrics used to evaluate their impact. Our results show improvements over state-of-art for each standard benchmark evaluated and learning quality metric investigated. Choosing just the right strategy can give an improvement of $23 \times$ in learning speed, $4 \times$ in performance potential, $3 \times$ in speedup over -O3, and has the potential to largely eliminate the fluctuation band from the final results. This work provides basis for an efficient recommender system enabling developers to choose the best possible reinforcement learning training options based on their target goals.