arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1902.02816cs.PLcs.PF
收藏

Revec:通过再向量化实现程序更新

Revec: Program Rejuvenation through Revectorization

Charith Mendis, Ajay Jain, Paras Jain, Saman Amarasinghe

摘要:

现代微处理器配备有单指令多数据(SIMD)或向量指令,其以细粒度暴露数据级并行性。程序员通过在代码中使用低级向量内部函数来利用这种并行性。然而,一旦使用特定指令集的向量内在函数编写程序,代码就变得不可移植。现代编译器无法分析代码并将其重定向到更新的向量指令集。因此,程序员必须使用新一代的向量内部函数手动重写相同的代码,以利用新指令集的更高数据宽度和功能。这个过程是乏味的,容易出错,需要维护多个代码库。我们提出Revec,一个编译器优化通过revectorizes已经矢量化的代码,通过重定向它使用新一代的矢量指令。转换是透明的,发生在编译器中间表示级别,并实现手动向量化代码的性能可移植性。Revec可以在现实世界的性能关键内核中实现性能改进。特别是,Revec在快速整数解包内核上实现了1.160 $\times$和1.430 $\times$的几何平均加速比,在手动矢量化的x265媒体编解码器内核上实现了1.145 $\times$和1.195 $\times$的加速比。我们还广泛测试了Revec对216个图像处理和模板内核的丰富内部实现的影响。

英文摘要:

Modern microprocessors are equipped with Single Instruction Multiple Data (SIMD) or vector instructions which expose data level parallelism at a fine granularity. Programmers exploit this parallelism by using low-level vector intrinsics in their code. However, once programs are written using vector intrinsics of a specific instruction set, the code becomes non-portable. Modern compilers are unable to analyze and retarget the code to newer vector instruction sets. Hence, programmers have to manually rewrite the same code using vector intrinsics of a newer generation to exploit higher data widths and capabilities of new instruction sets. This process is tedious, error-prone and requires maintaining multiple code bases. We propose Revec, a compiler optimization pass which revectorizes already vectorized code, by retargeting it to use vector instructions of newer generations. The transformation is transparent, happening at the compiler intermediate representation level, and enables performance portability of hand-vectorized code. Revec can achieve performance improvements in real-world performance critical kernels. In particular, Revec achieves geometric mean speedups of 1.160$\times$ and 1.430$\times$ on fast integer unpacking kernels, and speedups of 1.145$\times$ and 1.195$\times$ on hand-vectorized x265 media codec kernels when retargeting their SSE-series implementations to use AVX2 and AVX-512 vector instructions respectively. We also extensively test Revec's impact on 216 intrinsic-rich implementations of image processing and stencil kernels relative to hand-retargeting.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑