Skip to content

Booth 0.6.0

Latest

Choose a tag to compare

@Zaneham Zaneham released this 14 Sep 15:16
· 1 commit to master since this release

Kia ora, G'day and hello!

Here is Booth 0.6.0! This one has been a few months coming.

You can actually run it now! kath run kernel.cu compiles a kernel and runs it on whatever device you have, kath build compiles it, and kath doctor tells you what your machine can do and then tests it.

SASS makes an appearance with some of my own deciphering, and massive thanks to the wonderful folks at NAK, who have also reverse engineered some NVIDIA GPUs. kath --nvidia-cubin writes a cubin the card loads directly. Until now NVIDIA meant PTX and the driver's JIT.

CUDA has yet again received way too much damn love and I don't want to look at C++ for a while. ggml-cuda, the CUDA half of llama.cpp, now compiles through Booth, woohoo! All 67 of its files reach Booth's IR, and 47 of its kernels go through the new SASS backend.

Elsewhere:

  • kath run, kath build and kath doctor, with the docs updated to match.
  • The SASS backend lowers 32- and 64-bit division and remainder, float division, the int/float conversions, sqrt, sin, cos, exp2 and log2, min and max, and the 64-bit compares.
  • Class templates, explicit and partial specialisations, default template arguments, template-ids and enum class.
  • constexpr objects fold at every use, including as array bounds, and if constexpr picks its arm. Anything the folder can't evaluate refuses with E128.
  • Reference parameters work, so an accumulator written as float &acc actually accumulates.
  • CUDA vector types and the packed half2 pairs.
  • String literals in device code: NVIDIA lays them in .global, AMD in .rodata.
  • 756 AMD encodings checked against llvm-mc, and 55 of them were wrong. They aren't any more.
  • Device functions no kernel calls are dropped on AMD, so dead code stays in the bin.
  • Device-call inlining fixes: a self-call was overwriting its caller's block map, and DCE was sliding one function over another.
  • RV64 calls pass large structs by reference, keep the stack aligned past the eighth argument, and branch further than 4 KiB.
  • The Tensix SFPU refuses what it has no instruction for, instead of quietly computing the wrong answer. Subtract, compare and multiply are fixed there too.
  • The lowerer's tables no longer run out of room on a large translation unit.

The next target is LFortran 0.66, which passes a kernel's scalar arguments as a struct. That unblocks the Fortran work I've had sitting around for a while, and CI is pinned to 0.65 until it's done. I also got sent a Tenstorrent Blackhole chip so expect more work there too. The backends are also going to receive more love I've been porting some of my other code from other projects so expect to see some work there too.

Massive thanks to Hot Aisle (https://hotaisle.xyz) for access to AMD CDNA GPUs.

The docs have been updated too, so please check them out if you'd like to see how to use the new verbs.

Before someone asks "gee whizz, that's a tonne of code right there", well yes it is. A very significant portion of it comes from another project I've been working on since January (well, technically the groundwork started nearly two years ago now), which is a binary translator, and I'll probably be showcasing more of that over the coming months. No release date yet cause I am just one dude. Huge chur to Claude and Cursor, who helped significantly with adding a tonne of tests and changing up those programs so they could fit into Booth proper, as well as answering my dumb questions about C++.

Kind regards,

Zane