We have spent some effort putting into words the core design principles, tradeoffs and architectural decisions behind the
This document was accelerated in the past few days following Chris’ presentation and the proposal for the working group on Tensor Compute Primitives. There are still some omissions and cleanups required but at this point it is better to iterate in the open. This will hopefully give a deeper picture of the reasons why we have invested in this dialect since last April.
Special thanks go to @ftynse who proofread and reformulated large parts of the Introduction and Prior Art, and to Andrew Adams who kindly weighed in and corrected some of our lessons from Halide.
In his latest MLIR Open Design meeting presentation, Chris laid out a compelling vision for an MLIR-based codegen that would make the best use of the multi-level properties of the infrastructure and be driven by search. The MLIR Linalg dialect aims at bringing an answer to the higher-level codegen problem. This document describes the key design principles that led to the existing implementation of Linalg and aims at exposing the tradeoffs involved when building higher-level Intermediate Representations (IR) and Dialects to facilitate code generation. Linalg is designed to interoperate nicely within a Mixture Of Expert Compilers environment (i.e. the CGSel box).
This work is inspired by a wealth of prior art in the field, from which it seeks to learn key lessons. This documentation and introspection effort also comes in the context of the proposal for a working group for discussing the Development of high-level Tensor Compute Primitives dialect(s) and transformations.