This repository contains a structured series covering MLIR, compiler optimizations, GPU execution, transformers, and deep learning superoptimization.
- Part 1 - What and why MLIR?
- Part 2 - Memory in MLIR
- Part 3 - Affine Dialect and OpenMP
- Part 4 - Linear Algebra and Linalg
- Part 5 - Neural Networks and Tensors
- Part 6 - e-graphs and Term Rewriting
- Part 7 - NVIDIA GPU Execution
- Part 8 - Transformer Architecture
- Part 9 - Superoptimizing Deep Learning
MLIR requires a few dependencies to be installed. Follow the steps below.
Install the required build tools:
sudo apt-get update
sudo apt-get install -y cmake ninja-build ccacheClone the LLVM project repository, which contains MLIR:
git clone https://github.com/llvm/llvm-project.gitNote: Building MLIR can take a significant amount of time depending on your system (This tutorial is done on Linux based OS).
Create a build directory and configure the project:
mkdir -p llvm-project/build
cd llvm-project/build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=ON \
-DLLVM_TARGETS_TO_BUILD="Native;ARM;X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_CCACHE_BUILD=ONBuild and run MLIR tests:
cmake --build . --target check-mlirInstall MLIR:
cmake --build . --target installCheck the installed MLIR version:
mlir-opt --versionIf the installation was successful, the command will print the installed MLIR version information.