arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.04890cs.PLcs.ARcs.SE
收藏

为自动向量化在LLVM IR中改造控制流图

Retrofitting Control Flow Graphs in LLVM IR for Auto Vectorization

Shanghai Jiao Tong University(上海交通大学)

Shihan Fang, Wenxin Zheng

AI总结:

针对现有编译器自动向量化能力不足的问题,提出含SIR、VIR两种IR扩展的新型向量化流水线,构建灵活可扩展的框架,提升了向量化范围与效率,性能较LLVM和GCC最高分别提升53%、58%。

摘要:

现代处理器越来越依赖SIMD指令集(如AVX和RVV)来显著提升并行性与计算性能。然而,LLVM、GCC等成熟编译器因向量化 pass 相互独立且可扩展性有限,往往无法充分挖掘可用的向量化机会。尽管近期在启发式方法与中间表示(IR)设计方面的尝试已着手解决这些问题,但高效简化控制流分析、精准识别向量化机会仍是具有挑战性的任务。\n为解决上述问题,我们提出了一种新型向量化流水线,它具备两种专门的IR扩展:编码高层结构信息的SIR(结构中间表示),以及通过数据依赖分析显式表示指令依赖关系的VIR(向量中间表示)。借助VIR提供的细粒度依赖信息,我们构建了一个灵活且可扩展的向量化框架。该方法大幅提升了各向量化pass之间的互操作性,拓宽了识别同构指令的搜索空间,最终提升了自动向量化的覆盖范围与效率。实验评估表明,我们提出的向量化流水线实现了显著的性能提升,与LLVM和GCC相比,加速比分别高达53%和58%。

英文摘要:

Modern processors increasingly rely on SIMD instruction sets, such as AVX and RVV, to significantly enhance parallelism and computational performance. However, production-ready compilers like LLVM and GCC often fail to fully exploit available vectorization opportunities due to disjoint vectorization passes and limited extensibility. Although recent attempts in heuristics and intermediate representation (IR) designs have attempted to address these problems, efficiently simplifying control flow analysis and accurately identifying vectorization opportunities remain challenging tasks. To address these issues, we introduce a novel vectorization pipeline featuring two specialized IR extensions: SIR, which encodes high-level structural information, and VIR, which explicitly represents instruction dependencies through data dependency analysis. Leveraging the detailed dependency information provided by VIR, we develop a flexible and extensible vectorization framework. This approach substantially improves interoperability across vectorization passes and expands the search space for identifying isomorphic instructions, ultimately enhancing both the scope and efficiency of automatic vectorization. Experimental evaluations demonstrate that our proposed vectorization pipeline achieves significant performance improvements, delivering speedups of up to 53% and 58% compared to LLVM and GCC, respectively.

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

↑