Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

MLIR tutorials for Deep Learning optimization series

This repository contains a structured series covering MLIR, compiler optimizations, GPU execution, transformers, and deep learning superoptimization.

Note: The "ML" part of the MLIR name stands for "multi-level" (not machine learning!).

Table of Contents


Installing MLIR

MLIR requires a few dependencies to be installed. Follow the steps below.

Step 1: Install Dependencies

Install the required build tools:

sudo apt-get update
sudo apt-get install -y cmake ninja-build ccache

Step 2: Clone the LLVM Repository

Clone the LLVM project repository, which contains MLIR:

git clone https://github.com/llvm/llvm-project.git

Step 3: Build MLIR from Source

Note: 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=ON

Build and run MLIR tests:

cmake --build . --target check-mlir

Install MLIR:

cmake --build . --target install

Step 4: Verify the Installation

Check the installed MLIR version:

mlir-opt --version

If the installation was successful, the command will print the installed MLIR version information.

About

Let's learn MLIR from scratch in a well-structured way

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors