[RFC][Tutorial] A beginner-friendly end-to-end MLIR compiler pipeline

Hi all,

I’m a student and newcomer to MLIR and created an online tutorial that aims to make MLIR more beginner-friendly by walking through an end-to-end deep learning compiler pipeline.

Motivation:

Existing MLIR tutorials often focus on individual components, such as the language itself, specific dialects, or isolated lowering and execution examples. However, what is missing for beginners is a complete end-to-end pipeline demonstrating how deep learning models can be lowered from machine learning frameworks such as PyTorch to executable code and invoked from C/C++ on both CPU and GPU backends. This would lower the entry barrier for the MLIR ecosystem and help drive broader adoption of the technology.

This open-source, online tutorial provides an introductory, end-to-end overview of MLIR, aimed at newcomers and university students who want to understand how MLIR fits into a full compilation flow. The online tutorial covers the entire stack, from model definition in a machine learning framework to generating and executing native binaries on multiple targets. Rather than optimizing for performance or other efficiency metrics, the tutorial focuses on conveying the core MLIR concepts and the fundamental building blocks required to independently construct such a pipeline.

The online tutorial uses torch-mlir and existing upstream MLIR passes, and demonstrates how the pipeline can be extended by implementing a custom pass that lowers linalg.matmul operations to OpenBLAS library calls. It targets both CPU and NVIDIA GPU backends, giving readers a practical understanding of how MLIR enables flexible and extensible compiler design for machine learning workloads. The tutorial is publicly available as an open-source GitHub repository.

RFC:

While the tutorial itself is aimed at beginners, this proposal is intended for the broader MLIR community to gather feedback, suggestions for improvements, or ideas for future directions and features.

This looks great!

We’re building the infrastructure for a similar concept upstream called Project Lighthouse. Having help from new people would be invaluable to get a more nuanced perspective and build better tools.

For example, you could extend the existing Toy Tutorial in tree, and then we can use that inside Lighthouse to demo your project, as an example of a standalone independent project using the upstream infrastructure.

Nice! Kunwar also recently presented GitHub - Groverkss/mlir-tutor: Exercises for Learning MLIR (Originally written for PPoPP 2026) . We should have at least these all linked from mlir-www.

These tutorials look great. Lately I’ve been thinking about how to help people learn about our recent work on python-defined dialects in MLIR Python (beyond the talk we’ll give at EuroLLVM).

If we can show some pure-Python, end-to-end compiler pipelines, I think more people will get excited and try applying it in their own domains. As a small demo, I built a brainfuck JIT compiler in Python. It’s tiny, but it exercises three new MLIR Python features: defining dialects, rewrite patterns, and passes in Python.

I’m also considering rewriting the MLIR repo’s Toy Tutorial in Python, though that probably needs these features to mature further.

Thanks, that sounds like a great idea — I’d be happy to help.
I’ll explore Project Lighthouse and look into extending the Toy Tutorial in-tree in a meaningful way.
I’ll reach out once I have something concrete to share.

Sorry for the delay. Do you have an idea what this can look like? Just another section in tutorials with references to those (external) tutorials? Or even put them all upstream? Anyway, I think that’d be really nice for newcomers.

We could definitely host them upstream (put that depends on if those folks interested, and would require some thinking about how to organize things to make it easy to consume). Linking is easiest. Potentially with a little blurb about the tutorial to give an idea of focus/approach.

I would link them at the bottom of this page: Tutorials - MLIR ; after a disclaimer about these being third-party maintained and potentially out-of-sync with the upstream implementation, and asking to not file bugs against upstream.

I’ll just kick it off and ask people. I’ll go ahead and open a PR accordingly.