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

PolyBlocks:面向AI芯片和编程框架的编译器基础设施

PolyBlocks: A Compiler Infrastructure for AI Chips and Programming Frameworks

Polymage Labs(Polymage实验室);Indian Institute of Science(印度科学研究院)

Uday Bondhugula, Akshay Baviskar, Navdeep Katel, Vimal Patel, Anoop JS, Arnab Dutta

AI总结:

PolyBlocks是一种基于MLIR的编译器基础设施,通过自动代码生成和优化,实现AI编程框架到AI芯片的高效转换。

摘要:

我们提出了PolyBlocks,一种基于MLIR的模块化且可重用的编译器基础设施,用于AI编程框架和AI芯片。PolyBlocks基于传递管道,通过在循环嵌套和SSA上进行转换来组成变换,主要依赖于轻量级的仿射访问分析;这些变换通过专门的方式拼接,利用分析成本模型和启发式方法实现高性能代码的自动产生。这些传递中的优化包括多级分块、融合、芯片上的暂存器使用、将矩阵乘法和卷积映射到矩阵单元、融合注意力层以及几种其他用于并行性和局部性的变换。这些优化以一种易于构建针对新芯片的PolyBlocks编译器的方式开发,重用了大量基础设施。PolyBlocks的设计和架构使从高级框架到低级目标特定内建函数的完全自动代码生成成为可能。评估PolyBlocks驱动的即时编译在PyTorch和JAX上针对NVIDIA GPU的结果表明,它在某些情况下能够匹配或超越Torch Inductor和XLA,尽管后者依赖于一组供应商库和代码生成的结合。对于矩阵乘法和卷积等单个操作,PolyBlocks生成的代码与最佳供应商调优库或手动编写内核具有竞争力。

英文摘要:

We present the design and implementation of PolyBlocks, a modular and reusable MLIR-based compiler infrastructure for AI programming frameworks and AI chips. PolyBlocks is based on pass pipelines that compose transformations on loop nests and SSA, primarily relying on lightweight affine access analysis; the transformations are stitched together in specialized ways to realize high-performance code automatically by the use of analytical cost models and heuristics. The optimizations in these passes include multi-level tiling, fusion, on-chip scratchpad usage, mapping matmuls and convolutions to matrix units, fusing the attention layer, and several other transformations for parallelism and locality. They have been developed in a way that makes it easy to build PolyBlocks-based compilers to target new chips, reusing much of the infrastructure. PolyBlocks' design and architecture enable fully automatic code generation from high-level frameworks to low-level target-specific intrinsics. Experimental results from evaluating PolyBlocks-powered just-in-time compilation for PyTorch and JAX targeting NVIDIA GPUs show that it is able to match or outperform Torch Inductor and XLA in several cases, although the latter rely on a combination of vendor libraries and code generation. For individual operators like matmuls and convolutions, PolyBlocks-generated code is competitive with the best vendor-tuned libraries or hand-written kernels.

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

↑