一句话:通过分析程序结构与编译器文档筛选关键优化 flag,缩小搜索空间,实现高效的编译器自动调优。
GCC 等广泛使用的编译器包含数百个由优化 flag 控制的优化,用户很难手动完成调优;已有自动调优技术在整个优化空间中设计搜索策略来寻找优化序列,但面临搜索空间巨大、效率低下的问题。为缩减搜索空间,本文提出基于关键 flag 选择的方法 CFSCA:首先通过分析目标程序结构与编译器文档,找出与程序潜在相关的 flag;随后基于不同优化序列下程序预测运行时性能的统计分析,识别其中的关键 flag;最后在缩减后的搜索空间中选择期望的优化序列。作者在最新版 GCC 与广泛使用的 cBench 基准上开展实验,结果表明 CFSCA 显著优于四种对比技术,包括当前最先进的 BOCA。
Widely used compilers like GCC usually have hundreds of optimizations controlled by optimization flags, which can be enabled or disabled during compilation to improve the runtime performance of a compiled program. Due to the large number of optimization flags and their combination, it is difficult for compiler users to tune compiler optimization flags manually. In the literature, many auto-tuning techniques have been proposed, which find a desired setting on all optimization flags (i.e., an optimization sequence) by designing different search strategies in the entire optimization space. Due to the huge search space, these techniques suffer from the widely-recognized efficiency problem. To reduce the search space, in this paper, we propose a critical-flag selection based approach CFSCA which first finds flags potentially relevant to the target program by analyzing program structure and compiler documentation, and then identifies critical flags through statistical analysis on the program's predicted runtime performance with various optimization sequences. With the reduced search space, CFSCA selects a desired optimization sequence. To evaluate the performance of the proposed approach CFSCA, we conduct an extensive experimental study on the latest version of the compiler GCC with a widely used benchmark cBench. The experimental results show that CFSCA significantly outperforms the four compared techniques, including the state-of-art technique BOCA.