Remix.run Logo
AndyKelley 2 days ago

Huh?? That can only make frontends' jobs more tricky.

pjmlp 2 days ago | parent [-]

Yet is being embraced by everyone since its introduction in 2019, with its own organization and conference talks.

So maybe all those universities, companies and the LLVM project know kind of what they are doing.

- https://mlir.llvm.org/

- https://llvm.github.io/clangir/

- https://mlir.llvm.org/talks/

AndyKelley 2 days ago | parent [-]

No need to make a weird appeal to authority. Can you just explain the answer to my question in your own words?

marcelroed 2 days ago | parent | next [-]

I am only familiar with MLIR for accelerator-specific compilation, but my understanding is that by describing operations at a higher level, you don’t need the frontend to know what LLVM IR will lead to the best final performance. For instance you could say "perform tiled matrix multiplication" instead of "multiply and add while looping in this arbitrary indexing pattern", and an MLIR pass can reason about what pattern to use and take whatever hints you’ve given it. This is especially helpful when some implementations should be different depending on previous/next ops and what your target hardware is. I think there’s no reason Zig can’t do something like this internally, but MLIR is an existing way to build primitives at several different levels of abstraction. From what I’ve heard it’s far from ergonomic for compiler devs, though…

pjmlp 2 days ago | parent | prev [-]

You see it as appeal to authority, I see it as the community of frontend developers, based on Swift and Rust integration experience, and work done by Chris Lattner, while working at Google, feedbacking into what the evolution of LLVM IR is supposed to look like.

Mojo and Flang, were designed from scratch using MLIR, as there are many other newer languages on the LLVM ecosystem.

I see it as the field experience of folks that know a little bit more than I ever will about compiler design.