- Create a virtual environment and activate it:
python3 -m venv venv
source venv/bin/activate
- Install required packages:
pip install -r requirements.txt
- Check if the installation was successful:
python3 -m mlir_wheel --root-dir
- Configure CMake:
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH=$(python -m mlir_wheel --root-dir) -DLLVM_EXTERNAL_LIT=$(which lit)
- Build:
- Install the Python DSL package (editable mode):
# From project root directory (not the build directory).
pip install -e python/
- Set the
TUTORIAL_OPTenvironment variable to point to the builttutorial-optbinary:
export TUTORIAL_OPT=$PWD/build/tutorial/tutorial-opt
- Run an example to verify:
python tutorial/ch1-cpu-vector-dsl/square.py
The examples will print the generated MLIR at each lowering stage.
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