面向RISC-V的编译自动调优
CSTR:
作者:
作者单位:

军事科学院国防科技创新研究院

作者简介:

通讯作者:

中图分类号:

基金项目:


Compiler Autotuning for RISC-V
Author:
Affiliation:

Defense Innovation Institute, Academy of Military Sciences

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    现代编译器通常配备数百种程序优化策略,这些策略通过优化选项在编译过程中启用或禁用,以提升生成的二进制代码的性能表现。然而,对于特定程序而言,并非所有优化都能产生积极效果;相反,不同优化措施间可能存在相互作用,导致最终效果难以预测。鉴于现代编译器优化选项的复杂性及手动选择的困难性,本研究聚焦于编译器自动调优的优化选择问题,深入分析了经典的编译自动调优算法,包括遗传算法、贝叶斯优化、强化学习等,并在此基础上提出了一套适用于RISC-V架构的自动调优系统。该系统以流行的GCC编译器和典型的基准测试程序Coremark和Dhrystone为实验平台。在搭载RISC-V处理器的K230开发板上,通过实际运行程序获取优化选项组合与程序性能的对应关系,进而利用有监督或无监督学习方法自动搜索出最佳优化选项组合。实验结果表明,所提出的编译自动调优技术在RISC-V架构上取得了显著的性能提升。与编译器默认的O2或O3优化组合相比,该技术在Coremark上实现了10.7%至16.2%的程序执行性能提升,并在Dhrystone上实现了200%的性能提升。

    Abstract:

    Modern compilers typically come equipped with hundreds of program optimization strategies. These strategies are controlled by optimization options and can be enabled or disabled during the compilation process, in order to enhance the performance of the generated binary code. However, not all optimization options can produce positive effects in specific programs. Instead, interactions between different optimization options may lead to unpredictable outcomes. Given the complexity of optimization options and the difficulty of manual selection in modern compilers, this study focuses on the selection problem of compiler optimization. We conduct an in-depth analysis of classic compiler autotuning algorithms, including genetic algorithms, Bayesian optimization, and reinforcement learning. Based on this analysis, we propose an compiler autotuning system specifically designed for the RISC-V architecture. The system takes the popular GCC compiler and typical benchmark programs Coremark and Dhrystone as the experimental platform. On the K230 development board equipped with a RISC-V processor, it obtains the correspondence between optimization options and program performance by actually running the program, and then automatically searches for the best optimization combination by using supervised or unsupervised learning methods. Experimental results show that the proposed compiler autotuning technology achieves significant performance improvements on the RISC-V architecture. Compared to the compiler"s default O2 or O3 optimization combinations, this technology delivers a 10.7% to 16.2% improvement in program execution performance on Coremark and a 200% improvement on Dhrystone.

    参考文献
    相似文献
    引证文献
引用本文
分享
相关视频

文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2024-12-18
  • 最后修改日期:2025-01-24
  • 录用日期:
  • 在线发布日期: 2025-10-13
  • 出版日期:
文章二维码