MLIR frontend, and a mutation harness - #163
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asfixtures. 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).
--mlirreads a file andlowers it,
--mlir --ppprints back what it read.func.func,return,arith.constantand the arith binops, compares and conversions all lower toBIR, 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 inthe 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.