arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2502.11906cs.PFcs.DC
收藏

针对 X86 和 ARM CPU 的不同编译器向量化能力比较

Comparison of Vectorization Capabilities of Different Compilers for X86 and ARM CPUs

Nazmus Sakib, Tarun Prabhu, Nandakishore Santhi, John Shalf, Abdel-Hameed A. Badawy

AI总结:

该研究使用更贴近实际代码的 TSVC2 套件,评估 GCC、ICX、Clang、ACFL 在 x86 与 ARM 上的自动向量化表现,发现各编译器差异有限且向量化不必然提升性能。

摘要:

大多数现代处理器都包含向量单元,可同时对多组操作数执行相同的算术运算。编译器自动向量化代码的能力,对于有效利用这些单元至关重要。对于任何编写计算密集型、高性能且可移植代码的人来说,理解这一能力都很重要。我们测试了若干编译器在 x86 和 ARM 上对代码进行向量化的能力。我们使用了 TSVC2 测试套件,并对其进行修改,使其更能代表实际代码。在 x86 上,GCC 报告套件中 54% 的循环已被向量化,ICX 报告为 50%,Clang 为 46%。在 ARM 上,GCC 报告 56% 的循环已被向量化,ACFL 报告为 54%,Clang 为 47%。我们发现,向量化代码并不总是优于未向量化代码。在某些情况下,对于两个非常相似且可向量化的循环,编译器会向量化其中一个,却不向量化另一个。我们还报告了编译器仅在两个平台之一上向量化某个循环的情况。基于实验,我们无法明确断定在任一给定平台上,是否有某个编译器在代码向量化方面显著优于其他编译器。

英文摘要:

Most modern processors contain vector units that simultaneously perform the same arithmetic operation over multiple sets of operands. The ability of compilers to automatically vectorize code is critical to effectively using these units. Understanding this capability is important for anyone writing compute-intensive, high-performance, and portable code. We tested the ability of several compilers to vectorize code on x86 and ARM. We used the TSVC2 suite, with modifications that made it more representative of real-world code. On x86, GCC reported 54% of the loops in the suite as having been vectorized, ICX reported 50%, and Clang, 46%. On ARM, GCC reported 56% of the loops as having been vectorized, ACFL reported 54%, and Clang, 47%. We found that the vectorized code did not always outperform the unvectorized code. In some cases, given two very similar vectorizable loops, a compiler would vectorize one but not the other. We also report cases where a compiler vectorized a loop on only one of the two platforms. Based on our experiments, we cannot definitively say if any one compiler is significantly better than the others at vectorizing code on any given platform.

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

↑