6. AI Compiler Backend

In this chapter, we will explore the design of the AI compiler backend. The objective of an AI compiler backend is to enhance the efficiency of AI program execution by optimizing the Intermediate Representation (IR) generated by the compiler frontend. This optimization enables the full utilization of hardware capabilities. The backend achieves this goal by applying optimizations to IR code based on hardware capabilities. Furthermore, it selects suitable operators based on the capabilities of target hardware to execute computations efficiently, while also allocating memory to optimize data reuse and locality. Additionally, the backend often incorporates an operator compiler, which optimizes the execution strategy for code statements associated with operators.

This chapter aims to achieve the following learning objectives:

  • Understand the role and architecture of an AI compiler backend.

  • Understand typical methods for optimizing computational graphs.

  • Understand typical methods for selecting operators.

  • Understand typical methods for memory allocation.

  • Understand the architecture and functionalities of operator compilers.