MLIR Learning Resources
Very interested in diving into the weeds of ML compilers such as Modular and Triton. The overarching motivation -- other than the fact that ML compilers are super-interesting 🙂 -- is that in a world of increased demand for ML training / inference but limited GPU (NVIDIA) supply, the ability to write code that is performant and device-agnostic is evermore important.
Are you aware of any resources for learning MLIR incrementally, ideally building from basics to something like a "toy" Modular / Triton compiler, and more ambitiously, the ability to contribute new optimization passes to such compilers? I've walked through the official MLIR "toy" language tutorial and am looking for a hackable set of guides to bridge the gap between basics and real world use.
I realize it's not strictly necessary to understand MLIR -- as the purpose of Modular is to abstract away these details -- but I think it helps to understand how things work under the hood.
My background is ML researcher / engineer so have limited experience with compilers (ML or otherwise) but am eager to learn so as to fully leverage languages such as Mojo, Triton, etc.
5 Replies
I recommend https://github.com/j2kun/mlir-tutorial and the corresponding blog series. Not DL focused but is very approachable.
GitHub
GitHub - j2kun/mlir-tutorial: MLIR For Beginners tutorial
MLIR For Beginners tutorial. Contribute to j2kun/mlir-tutorial development by creating an account on GitHub.
If you would like to stick to Python instead of C++, then checkout https://xdsl.dev/
xDSL
xDSL
A Python-Native Compiler Toolkit
Design your own (domain-specific) compiler by mixing predefined IRs with your custom IR abstractions. Always optimize at the optimal abstraction level by lowering programs through multiple levels of IRs. Connect with the LLVM/MLIR ecosystem while benefiting from Python's productivity.
...
Design your own (domain-specific) compiler by mixing predefined IRs with your custom IR abstractions. Always optimize at the optimal abstraction level by lowering programs through multiple levels of IRs. Connect with the LLVM/MLIR ecosystem while benefiting from Python's productivity.
...
At EuroLLVM last year, the xDSL team gave a talk on the project
LLVM
YouTube
2023 EuroLLVM - Prototyping MLIR in Python
2023 European LLVM Developers' Meeting
https://llvm.org/devmtg/2023-05/
------
Prototyping MLIR in Python
Speaker: Mathieu Fehr & Sasha Lopoukhine
------
Slides: https://llvm.org/devmtg/2023-05/slides/TechnicalTalks-May11/05-Fehr-PrototypeMLIRinPython.pdf
-----
We present xDSL, a reimplementation of MLIR core features in pure Python with a focus...
@RascalJack Thanks, have already worked through both of those.