Dedicated tensor accelerators demonstrate the importance of linear algebra in modern applications. Such accelerators have the potential for impressive performance gains, but require programmers to rewrite code using vendor APIs - a barrier to wider scale adoption. Recent work overcomes this by matching and replacing patterns within code, but such approaches are fragile and fail to cope with the diversity of real-world codes. We develop ATC, a compiler that uses program synthesis to map regions of code to specific APIs. The mapping space that ATC explores is combinatorially large, requiring the development of program classification, dynamic analysis, variable constraint generation and lexical distance matching techniques to make it tractable. We apply ATC to real-world tensor and linear algebra codes and evaluate them against four state-of-the-art approaches. We accelerate between 2.6x and 7x more programs, leading to over an order of magnitude performance improvement.
翻译:专用张量加速器展示了线性代数在现代应用中的重要性。此类加速器具有实现显著性能提升的潜力,但要求程序员使用厂商API重写代码——这成为其广泛采用的障碍。近期工作通过匹配和替换代码中的模式来克服这一问题,但此类方法较为脆弱,难以应对真实世界代码的多样性。我们开发了ATC编译器,利用程序综合将代码区域映射至特定API。ATC探索的映射空间呈组合式爆炸增长,为此需要发展程序分类、动态分析、变量约束生成及词汇距离匹配技术使其可处理。我们将ATC应用于真实世界的张量和线性代数代码,并与四种最先进方法进行对比评估。我们加速的程序数量增加了2.6至7倍,带来了超过一个数量级的性能提升。