LLM-Vectorizer:基于大语言模型的可验证循环向量化器
LLM-Vectorizer: LLM-based Verified Loop Vectorizer
AI总结:
本文提出基于有限状态机多智能体与测试反馈的 LLM-Vectorizer 方法,利用大语言模型生成向量化代码,在 TSVC 上实现 1.1x-9.4x 加速,并用 Alive2 验证了 38.2% 的向量化正确性。
摘要:
向量化是一种强大的优化技术,可显著提升对大型数据数组进行操作的高性能计算应用的性能。尽管自动向量化已有数十年的研究,编译器仍经常错失向量化代码的机会。另一方面,使用编译器内建函数手动编写向量化代码仍然是一项复杂且容易出错的任务,需要深入了解特定架构和编译器。在本文中,我们评估了大语言模型(LLMs)从处理单个数组元素的标量程序生成向量化(单指令多数据)代码的潜力。我们提出了一种新颖的基于有限状态机多智能体的方法,利用大语言模型和基于测试的反馈来生成向量化代码。我们的研究结果表明,与英特尔编译器、GCC 和 Clang 等最先进的编译器相比,大语言模型能够生成高性能的向量化代码,运行时加速比从 1.1 倍到 9.4 倍不等。为了验证向量化代码的正确性,我们使用 Alive2,这是一种用于 LLVM IR 的领先的有界翻译验证工具。我们描述了几种领域特定的技术,以提高 Alive2 在我们基准数据集上的可扩展性。总体而言,我们的方法能够在 TSVC 基准数据集上将 38.2% 的向量化验证为正确。
英文摘要:
Vectorization is a powerful optimization technique that significantly boosts the performance of high performance computing applications operating on large data arrays. Despite decades of research on auto-vectorization, compilers frequently miss opportunities to vectorize code. On the other hand, writing vectorized code manually using compiler intrinsics is still a complex, error-prone task that demands deep knowledge of specific architecture and compilers. In this paper, we evaluate the potential of large-language models (LLMs) to generate vectorized (Single Instruction Multiple Data) code from scalar programs that process individual array elements. We propose a novel finite-state machine multi-agents based approach that harnesses LLMs and test-based feedback to generate vectorized code. Our findings indicate that LLMs are capable of producing high performance vectorized code with run-time speedup ranging from 1.1x to 9.4x as compared to the state-of-the-art compilers such as Intel Compiler, GCC, and Clang. To verify the correctness of vectorized code, we use Alive2, a leading bounded translation validation tool for LLVM IR. We describe a few domain-specific techniques to improve the scalability of Alive2 on our benchmark dataset. Overall, our approach is able to verify 38.2% of vectorizations as correct on the TSVC benchmark dataset.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。