Skip to content

MLIR frontend, and a mutation harness - #163

Merged
Zaneham merged 5 commits into
masterfrom
feat/mlir-frontend
Aug 12, 2026
Merged

MLIR frontend, and a mutation harness#163
Zaneham merged 5 commits into
masterfrom
feat/mlir-frontend

Conversation

@Zaneham

@Zaneham Zaneham commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Hey, this is one of my larger PRs. I'm rolling a few things into it rather than
splitting them up.

NOW DONT BE ALARMED BY THE DIFF. Almost none of it is new code. Of the 25,563
added lines, 22,690 are @certik's MLIR parser vendored under
src/mlir/vendor, and another 975 are his test files, which I've borrowed as
fixtures. What's left is about 800 lines of tests and 972 lines of compiler.

Thanks to @certik for pointing me at that parser. It's pure C with no LLVM
anywhere in it, which is the only reason any of this was possible, and it means
Booth now supports MLIR (or at least a subset of it). --mlir reads a file and
lowers it, --mlir --pp prints back what it read. func.func, return,
arith.constant and the arith binops, compares and conversions all lower to
BIR, and from there it goes down the same pipeline CUDA and Triton use, so MLIR
reaches all four backends. Anything outside that subset gets named on stderr
and refused rather than skipped, because a skipped op still compiles and then
computes something else.

The other half of this is tests. There's a mutation harness now, make mutate,
which bends one line of the compiler at a time in a scratch copy and checks the
suite notices. It found six tests straight away that were not testing what they
looked like they were. My favourite is that the only SOP2 encoding test used
s_add_u32, and that opcode is 0x00, so the opcode field could sit anywhere in
the instruction word and every test stayed green.

The goal with all of it is covering my bases. I've also been trying out some of
the frontier models now that I'm employed full time and can afford the
subscription, so expect a flurry of LLM generated issues about gaps in the
compiler. If you've been using Booth and running into things, please raise an
issue as well.

I'm going to be semi-absent from Booth for a while. I want to put time into
some other open source projects, and I have a few things going on in my life. I
will still be reading issues.

After that the plan is Tenstorrent, now that I have a card to test on.

@Zaneham Zaneham added MLIR MLIR frontend (core dialect subset) enhancement New feature or request Triton Triton frontend (Python subset, tl.* intrinsics) labels Aug 12, 2026
@Zaneham
Zaneham merged commit e737f68 into master Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request MLIR MLIR frontend (core dialect subset) Triton Triton frontend (Python subset, tl.* intrinsics)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant