Groverkss/mlir-tutor

Exercises for Learning MLIR (Originally written for PPoPP 2026)

109

stars

30

commits

C++

primary language

Jul 21, 2026

updated

README

Installation Instructions

  1. Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
  1. Install required packages:
pip install -r requirements.txt
  1. Check if the installation was successful:
python3 -m mlir_wheel --root-dir
  1. Configure CMake:
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=$(python -m mlir_wheel --root-dir) -DLLVM_EXTERNAL_LIT=$(which lit)
  1. Build:
make -j

Installing Python Package

  1. Install the Python DSL package (editable mode):
# From project root directory (not the build directory).
pip install -e python/
  1. Set the TUTORIAL_OPT environment variable to point to the built tutorial-opt binary:
export TUTORIAL_OPT=$PWD/build/tutorial/tutorial-opt
  1. Run an example to verify:
python tutorial/ch1-cpu-vector-dsl/square.py

The examples will print the generated MLIR at each lowering stage.

Doing tutorial exercises

Each tutorial chapter has a README.md file explaining how to start with the exercise and some basic explanation of the exercise. For example, check out tutorial/ch1-cpu-vector-dsl/README.md

Contributors

Groverkss

30 commits

Groverkss/mlir-tutor

Exercises for Learning MLIR (Originally written for PPoPP 2026)

109

stars

30

commits

C++

primary language

Jul 21, 2026

updated

README

Installation Instructions

  1. Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
  1. Install required packages:
pip install -r requirements.txt
  1. Check if the installation was successful:
python3 -m mlir_wheel --root-dir
  1. Configure CMake:
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=$(python -m mlir_wheel --root-dir) -DLLVM_EXTERNAL_LIT=$(which lit)
  1. Build:
make -j

Installing Python Package

  1. Install the Python DSL package (editable mode):
# From project root directory (not the build directory).
pip install -e python/
  1. Set the TUTORIAL_OPT environment variable to point to the built tutorial-opt binary:
export TUTORIAL_OPT=$PWD/build/tutorial/tutorial-opt
  1. Run an example to verify:
python tutorial/ch1-cpu-vector-dsl/square.py

The examples will print the generated MLIR at each lowering stage.

Doing tutorial exercises

Each tutorial chapter has a README.md file explaining how to start with the exercise and some basic explanation of the exercise. For example, check out tutorial/ch1-cpu-vector-dsl/README.md

Contributors

Groverkss

30 commits

Languages

C++

43.3%

MLIR

34.9%

Python

15.3%

CMake

6.5%