Vectorization-aware loop unrolling with seed forwarding

Vectorization-aware loop unrolling with seed forwarding
复制标题

DOI:
10.1145/3377555.3377890
复制
发表时间:
2020-02
期刊:
Proceedings of the 29th International Conference on Compiler Construction
影响因子:
--
通讯作者:
Rodrigo C. O. Rocha;Vasileios Porpodas;Pavlos Petoumenos;L. F. Góes;Zheng Wang;M. Cole;Hugh Leather
Rodrigo C. O. Rocha;Vasileios Porpodas;Pavlos Petoumenos;L. F. Góes;Zheng Wang;M. Cole;Hugh Leather
中科院分区:
其他
文献类型:
--
作者:
Rodrigo C. O. Rocha;Vasileios Porpodas;Pavlos Petoumenos;L. F. Góes;Zheng Wang;M. Cole;Hugh Leather

文献摘要

相似文献

循环展开是一种广泛采用的循环转换,通常用于实现后续优化。直线代码矢量化(SLP)是一种受益于展开的优化。SLP将同构的指令序列转换为向量代码。由于展开生成重复的同构指令序列,因此它使SLP能够向量化更多的代码。然而,大多数产生式编译器独立且不协调地应用这些优化。展开通常是为了避免代码膨胀,而不是最大化向量化的潜力,从而导致错失向量化机会。我们提出了VALUE,一种新颖的循环展开启发式算法,在进行展开决策时考虑了矢量化。我们的启发式方法是由一项分析支持的,该分析估计了SLP向量化对于展开的循环版本的潜在好处。然后我们的启发式算法选择最大限度地利用向量单元的展开系数。VALUE还将可矢量化的代码转发给SLP,允许其绕过对可矢量化种子指令的贪婪搜索,从而提供更多的矢量化机会。我们在一个生产编译器上的评估显示,VALUE揭示了默认循环展开程序和向量化器错过的许多向量化机会。这为TSVC基准测试套件的17个内核带来了更多的矢量化代码和显著的性能加速,与已经高度优化的-03相比,加速比高达2倍。我们对自由本奇和米本奇的完整基准测试的评估表明,VALUE带来了1.06倍的地理平均加速比。
Loop unrolling is a widely adopted loop transformation, commonly used for enabling subsequent optimizations. Straight-line-code vectorization (SLP) is an optimization that benefits from unrolling. SLP converts isomorphic instruction sequences into vector code. Since unrolling generates repeatead isomorphic instruction sequences, it enables SLP to vectorize more code. However, most production compilers apply these optimizations independently and uncoordinated. Unrolling is commonly tuned to avoid code bloat, not maximizing the potential for vectorization, leading to missed vectorization opportunities. We are proposing VALU, a novel loop unrolling heuristic that takes vectorization into account when making unrolling decisions. Our heuristic is powered by an analysis that estimates the potential benefit of SLP vectorization for the unrolled version of the loop. Our heuristic then selects the unrolling factor that maximizes the utilization of the vector units. VALU also forwards the vectorizable code to SLP, allowing it to bypass its greedy search for vectorizable seed instructions, exposing more vectorization opportunities. Our evaluation on a production compiler shows that VALU uncovers many vectorization opportunities that were missed by the default loop unroller and vectorizers. This results in more vectorized code and significant performance speedups for 17 of the kernels of the TSVC benchmarks suite, reaching up to 2× speedup over the already highly optimized -O3. Our evaluation on full benchmarks from FreeBench and MiBench shows that VALU results in a geo-mean speedup of 1.06×.