Replies: 11 comments 34 replies
-
MLIR seems to be finding success as a solution to these "post-Moore's Law" challenges of being useful to target heterogeneous hardware and building compilers for DSLs. Approaching the problem from the startup-like approach of building a platform for others to build upon, MLIR saw adoption from leading ML companies re-writing ML framework backends as MLIR dialects, namely OpenAI's TritonGPU dialect. Recent funding for the Mojo language builds on this success leveraging MLIR as backend to more easily surface performance optimizations and heterogeneous hardware auto-tuning to more high level application developers. |
Beta Was this translation helpful? Give feedback.
-
I have always been a huge fan of MLIR due to the pains that one endures when compiling functional language features to LLVM IR. As noted in the paper, LLVM really is a backend designed for C-like languages--integrating dispatch and pattern matching are pretty difficult. This MLIR-based functional IR demonstrates how MLIR might address these issues. I'd be super excited to see someone come up with an MLIR-based IR for lazy languages. |
Beta Was this translation helpful? Give feedback.
-
As someone with past experience with ML and is interested into diving into the world of ML compilers, this was quite an interesting paper to read. Intuitively, it makes sense that LLVM can be at too low of a level to immediately be useful as an IR for many programming languages. As such, providing a unified general framework for higher-level IRs that eventually can be taken down to LLVM seems incredibly useful, and seems of a similar philosophy to the unified frameworks for garbage collection and dataflow analysis we discussed previously (though this seems far more useful). |
Beta Was this translation helpful? Give feedback.
-
In the conclusion the authors write
It's only been 3 years since this paper but I wonder how much the community has embraced this idea. |
Beta Was this translation helpful? Give feedback.
-
MLIR aims to address the challenges brought by heterogeneity by building an extremely extensible compiler infrastructure. It seems to me that MLIR can do everything related to programming. However, one key part of heterogeneous system that is not well discussed in the paper is the orchestration of different compute units (CPUs, GPUs, accelerators, ...); inferring the scheduling and data movements may exceed the scope of a traditional compiler. I think MLIR has the potential to combine compiler technologies (tracing, program synthesis, ...) and eventrally solve the problem. |
Beta Was this translation helpful? Give feedback.
-
I was wondering about DSLs that allow users to write DSLs. Is there some result that talks about the expressivity of DSLs with respect to the language it is written in? I assume it can't be as expressive was the parent language since then there would be a contradiction on the expressivity of the parent language. |
Beta Was this translation helpful? Give feedback.
-
This point is really interesting. This also reminds me of what we discussed last lecture about how compiler optimizations make it impossible to implement threading as a library. Such "WYSINWYX" property makes it really hard to make sure if a piece of code is secure. |
Beta Was this translation helpful? Give feedback.
-
A small detail but I found interesting that, when listing MLIR's motivations, the authors' first issue with current infrastructures was "poor error messages." It's nice knowing there are lots of these smaller quality-of-life improvements (i.e., not necessarily performance-related) happening for languages. I think a good reason why people like is because of how clear the messages are. On the other hand I found Julia rather challenging to learn at first since the error messages were mostly just stack trace dumps (cite: Pragmatic Programmer on error messages). |
Beta Was this translation helpful? Give feedback.
-
I think its fair to say that the multi-layered approach is the crux of MLIR: we get a compiler infrastructure that is very good at mixing different levels of abstraction, and that generally makes implementing optimization passes more idiomatic. We can now optimize around higher-level semantics, instead of trying to extract it from a CFG. For example, extracting natural loops from CFG analysis in LLVM versus For example, I think final code generation can be made difficult by MLIR, because you potentially have more Op types to lower and arbitrary Op nestings to deal with. On the other hand, LLVM CFG's provide a uniform way to generate code. This is purely a software engineering problem, not a limitation of MLIR IR itself. But I do think its a fair problem to point out that needs to be fixed eventually. There are so many dialects, and it's hard to manage so many interfaces to fight code duplication. |
Beta Was this translation helpful? Give feedback.
-
I really enjoyed this paper, as it read almost like a design document. One think that really struck me as impressive about this was MLIR's possible contributions to HPC and ML. MLIR is flexible enough to support different data models, and can infer specific "Op" implementations from particular data shapes, which is of course very important in ML computations. I thought this was cool because looking at CUDA code -- it seems like creating a generalizable framework that can support something like that is kind of a beautiful abstraction. Also because we learned in class how parallelism and concurrency is poorly supported in many compilers, but also knowing that it is very important for HPC -- it seemed really promising how MLIR offers the ability to represent parallel constructs as first-class ops, which could possibly simplify the modeling and optimization of parallelism in ML and HPC applications. |
Beta Was this translation helpful? Give feedback.
-
The DRR DSL kind of reminded me a bit of the Alive paper we read. The more general expressivity of MLIR's rewrite system seems like it could pose quite a challenge to any kind of verification, however, it would be really cool if we see such a system in the future, at least to a certain extent. There's also the trouble of handling the extensibility of operations and dialects, but like the optimization interfaces, I'd imagine there would need to be an opt-in way of providing formal semantics for custom operations. It's interesting to observe the return of nested IRs. Their motivations for doing so make perfect sense, and the gradual lowering approach and ability to define passes at different abstraction layers seems like a great way to get the best of both worlds. Yet it still feels... strange? going against more recent trends for flat IRs. It makes sense, MLIR is trying to be one infrastructure for all levels of IRs, not just the middle-end where it seems flat representations have become popular. But regardless, I was reminded of this line in the Bril docs
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone! Here is the discussion for the MLIR paper on 11/28. MLIR is a novel approach to building reusable and extensible compiler infrastructure. MLIR was developed as a solution to the problem of modern high level languages often building their own high level IRs in front of LLVM. In doing so, many of the same kinds of technologies were reinvented across different high level IRs. Other motivations for the development of MLIR included improving the compilation for heterogeneous hardware and reducing the cost of building compilers for DSLs. What do you think of MLIR as a solution to these "post-Moore's Law" challenges?
Beta Was this translation helpful? Give feedback.
All reactions