# Matching Linear Algebra and Tensor Code to Specialized Hardware Accelerators

**Authors:** Pablo Antonio Martínez, Jackson Woodruff, Jordi Armengol-Estapé, Gregorio Bernabé, José Manuel García, Michael F. P. O'Boyle  
**arXiv:** [2301.11659](https://arxiv.org/abs/2301.11659)  
**Date:** 2023-01-27  
**Summary page:** https://www.summarizepaper.com/en/arxiv-id/2301.11659v2/

## Key points

- The research paper focuses on achieving impressive performance gains in modern applications that rely on linear algebra.
- Dedicated tensor accelerators have potential, but their adoption is hindered by the need for programmers to rewrite code using vendor APIs.
- Existing approaches to matching and replacing patterns within code are often fragile and fail to cope with the diversity of real-world codes.
- The authors develop ATC, a compiler that uses program synthesis to map regions of code to specific APIs.
- ATC explores a combinatorially large mapping space, requiring the development of program classification, dynamic analysis, variable constraint generation, and lexical distance matching techniques to make it tractable.
- The authors apply ATC to real-world tensor and linear algebra codes and evaluate them against four state-of-the-art approaches.
- ATC accelerates between 2.6x and 7x more programs than existing methods, leading to over an order of magnitude performance improvement.
- Program synthesis can be used to optimize code for specialized hardware accelerators without requiring extensive manual rewriting of code.

## Summary

Matching Linear Algebra and Tensor Code to Specialized Hardware Accelerators is a research paper that addresses the challenge of achieving impressive performance gains in modern applications that rely on linear algebra. The authors highlight the potential of dedicated tensor accelerators, but note that their adoption is hindered by the need for programmers to rewrite code using vendor APIs. While recent work has attempted to overcome this issue by matching and replacing patterns within code, such approaches are often fragile and fail to cope with the diversity of real-world codes. To address this challenge, the authors develop ATC, a compiler that uses program synthesis to map regions of code to specific APIs. The mapping space explored by ATC is combinatorially large, requiring the development of program classification, dynamic analysis, variable constraint generation, and lexical distance matching techniques to make it tractable. The authors apply ATC to real-world tensor and linear algebra codes and evaluate them against four state-of-the-art approaches. They find that ATC accelerates between 2.6x and 7x more programs than existing methods, leading to over an order of magnitude performance improvement. This research paper provides valuable insights into how program synthesis can be used to optimize code for specialized hardware accelerators. By developing a compiler that can automatically map regions of code to specific APIs without requiring extensive manual rewriting of code, the authors have demonstrated how performance gains can be achieved with significant potential for wider scale adoption in modern applications that rely on linear algebra.
