Compiler Intermediate Representations

January 4, 2021 -

LLVM, MLIR and dialects

Rant on.

Seems like everyone is still jumping on the ML (aka matrix/tensor graph) bandwaggon; essentially this is already a solved problem as far as scientific programmers are concerned, use Fortran. Seriously the mono-culture is a bit boring by now; most of us are shipping 1d byte arrays. You want fast low-precision matrix multiply all day? Then write a GPU kernel and get busy; there are more interesting problems to solve IMO. MMEMQ does a great job IIRC.

LLVM and now MLIR is such a huge toolchain that it can only have been the product of a corporate sponsorship (Apple) and now Google have joined the party. It takes a corp to burn all of our cycles. Thankfully Apple are giving some back with the M1 maybe I should just learn Swift and it will all be fine.

Haskell already has a high-level IR (System \(F^c\)/Core) and a low level IR (c–) maybe we should just focus on a runtime that doesn’t use C and undefined behaviour. Time the C era was drawn to a close?

There were some good ideas in there but I got lost among the layers and I think we should be working in our self-hosting languages as much as possible. Rant off.

QBE

Now here’s something a SSA translator written in a few hundred lines of C that spits out x86_64 and aarch64 assembly. 90% of the bang for 10% of the buck. Way to go. I’ll see if I can write a RTS in it…