Nicolai Hähnle, a compiler engineer working on LLVM and AMD GPU tooling, writes about code review, IR design and building HIP.
Commenters respect him as 'one of our best'; HN links his posts on patch-series code review, LLVM dialects and setting up HIP.
(Early disclaimer: I am an author of the paper and of MLIR, but this is a personal opinion)
I am somehow surprised by the reaction but at the same time I expected as much. We chose to make MLIR open-source early in the design and development, may be half a year after the first line was written, because we value open source and believe that a community can help build significantly better things that serve a broader audience. I find it unreasonable to expect a new infrastructure to have the same amount of frontends/optimizers/backends/utilities/bells-and-whistles as a project that has been around for 17 years and has got contributions from hundreds of developers employed by dozens of companies. 15 years ago, LLVM only had a fraction of what it has today... By making MLIR open from the start, we let everybody add the whistles they need, or collaborate on them with other people who also need them. That is sort of the point of open source community. Personally, I am happy to work with anybody who shares my needs, but I won't do somebody else's job instead of them. In a sense, MLIR does not intend to solve any specific compiler problem, but rather give people tools that help them focus on the problem at hand instead of IR infrastructure, storage, serialization etc.
The alternative would have been to develop it internally for a long time, driven exclusively by the internal needs, and then just throw it over the fence into public. It would have had significantly more "features". I…
FWIW, its use has grown over time, with new applications most significantly including MLIR (Multi-Level IR compiler framework, which allows you to define your own intermediate representations as well as compiler passes operating on them), https://mlir.llvm.org/docs/DefiningDialects/Operations/
The docs have been improving, https://llvm.org/docs/TableGen/
I also like these resources:
Lessons in TableGen
FOSDEM 2019; Nicolai Hähnle
https://fosdem.org/2019/schedule/event/llvm_tablegen/
- What has TableGen ever done for us?, http://nhaehnle.blogspot.com/2018/02/tablegen-1-what-has-tablegen-ever-done.html
- Functional Programming, http://nhaehnle.blogspot.com/2018/02/tablegen-2-functional-programming.html
- Bits, http://nhaehnle.blogspot.com/2018/02/tablegen-3-bits.html
- Resolving variables, http://nhaehnle.blogspot.com/2018/03/tablegen-4-resolving-variables.html
- DAGs, http://nhaehnle.blogspot.com/2018/03/tablegen-5-dags.html
Hähnle is one of our best, that'll be solid. http://nhaehnle.blogspot.com/2024/02/building-hip-environment-from-scratch.html. Looks pretty similar to how I build it.
Side point, there's a driver in your linux kernel already that'll probably work. The driver that ships with rocm is a newer version of the same and might be worth building via dkms.
Very strange that the rocm github doesn't have build scripts but whatever, I've been trying to get people to publish those for almost five years now and it just doesn't seem to be feasible.
My understanding is that they're not necessarily asking for the commits to be squashed, they're asking for them to be submitted together as a patch series.
Patch series are an important part of a healthy review workflow because they allow both a micro and a macro view of changes. I have written about this before: http://nhaehnle.blogspot.com/2020/06/they-want-to-be-small-they-want-to-be.html