MLIR Compiler Engineering is a practical guide for compiler engineers, systems programmers, and machine-learning infrastructure developers who build compilers and hardware accelerators on top of MLIR, the Multi-Level Intermediate Representation in the LLVM project.
The book opens with MLIR's architecture and rationale: the multi-level design, operations, regions, blocks, and SSA values, and the role of dialects as modular, interoperable semantic containers. It then covers defining your own dialects and operations with the Operation Definition Specification (ODS), TableGen, and the C++ and Python APIs, including custom types and attributes, verifiers, assembly formats, and diagnostics.
Later chapters work through constructing, parsing, and validating IR; the pass infrastructure and pattern-based rewriting; and the analysis and dataflow frameworks, including alias and dependence analysis. Lowering, dialect conversion, type conversion, and bufferization are then covered as the path from high-level representations to platform code.
Performance chapters address loop tiling, fusion, vectorization, polyhedral scheduling, and kernel generation for sparse and quantized workloads. Code-generation chapters cover LLVM, NVVM, ROCDL, GPU, and SPIR-V targets, ABI concerns, and emission workflows. Accelerator chapters cover StableHLO and TOSA import, quantization, and DMA scheduling. The final chapters turn to tooling, testing with lit and FileCheck, Python integration, visualization, security, and production deployment.