LLVM is a comprehensive compiler suite that empowers the creation of custom programming languages (referred to as frontends) and their integration with specific target platforms (known as backends). Situated between the frontend and backend is a critical component known as an “abstract syntax tree” (AST), which facilitates various transformations. The AST is a data structure that retains all the essential information from the input programming language.
However, MLIR introduces an intermediate representation (IR) that sacrifices this information preservation capability but offers the opportunity to incorporate specialized optimization features, that maybe lose of input information. These optimizations are termed “dialects” and can be executed through diverse, concurrent methods. This approach is referred to as the “multi-level intermediate representation,” as it provides multiple levels of optimization (aka “passes”).
One drawback is that even for backend integration, the final level usually adhere to the LLVM intermediate representation, but also any own hardware targets are feasible e.g., own machine learning hardware accelerator. A nice example can be found here (external link).
Nice example https://github.com/Lewuathe/mlir-hello.git or https://github.com/amshafer/Pinch