122 points · by matt_d · 3y ago · 46 comments
On one hand MLIR seems like it would be nice to work with. LLVM IR is fairly low-level and hard to debug, but has a great API; it would be great to use such an API but keep things like type-safety and invariants, and worry less about tricky undefined behavior. On the other hand, despite claims of extensibility and flexibility, it's hard to imagine it being easier to work with than a custom IR. Plus, it seems MLIR's extensibility was build to support some things in particular (custom architectures, "affine / polyhedral" optimizations).
> Plus, it seems MLIR's extensibility was build to support some things in particular
this isn't true in the least. just go to https://mlir.llvm.org/docs/Dialects/ and you'll see the set of upstream dialects is very diverse. and that's just upstream.
Why?
I attended an MLIR online meeting months back and there was someone presenting who had a diagram that literally had a dozen different dialects and converters that were being written between different ones (but not MxN, so it was a strictly relatively arbitrary set of combinations that were being converted between, and mostly one-directional if I recall correctly). This was the “solution” to being able to make various things interoperate, but from a distance it looks a lot like a relatively obvious problem caused by the very nature of the design of MLIR.
Then with MLIR you want to do ML optimizations, which require even _higher_ level constructions like identifying linear algebra ops, so you can do stuff like tiling optimizations and lower to dedicated hardware instructions. THe high level MLIR dialects enables that information to be preserved as long as possible so that it's easier to implement all the magic.
no one stumbles on this repo by accident (jeremy didn't post it here). the only way you find it is you google "mlir tutorial" ie you know what MLIR is and you're actively explicitly looking for a tut. there is no situation where you're ambushed by this content.
like if i write a tutorial "integration by parts for beginners" but don't define integration are you gonna claim that it fails at being for beginners? does every title from now on need to explicitly have "... for beginners who know what this is and have already made the decision to start studying".
but the guy himself didn't post it. how are people so entitled that they're upset about a deficiency in a thing that they sought out. no one is making you go the repo (or asking you to go).
it's literally like complaining about free samples at costco - if you don't like what they have don't take one!
> As we announced recently, my team at Google has started a new effort to build production-worthy engineering tools for Fully Homomorphic Encryption (FHE). One focal point of this, and one which I’ll be focusing on as long as Google is willing to pay me to do so, is building out a compiler toolchain for FHE in the MLIR framework (Multi-Level Intermediate Representation). The project is called Homomorphic Encryption Intermediate Representation, or HEIR
And MLIR there links to the MLIR project page.
> This is the code repository for a series of articles on the MLIR framework.
And then has links to the (currently written) articles, the first one with "(Getting Started)" in the title. Seems like an obvious place to, you know, start reading about things.
see eg. https://github.com/j2kun/mlir-tutorial/blob/92723e224c1a6e8c...
I found the standalone example https://github.com/llvm/llvm-project/tree/main/mlir/examples... in the MLIR repo to be very useful, on the other hand.