Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install gcovr
run: sudo apt-get update && sudo apt-get install -y gcovr
run: pipx install "gcovr>=8"
- name: Build instrumented and run suite
run: make coverage
- name: Summary
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/numeric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
environment-name: lf
create-args: >-
python=3.11
lfortran
lfortran=0.65.0

- name: Numeric regression vs baseline
env:
Expand Down
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
Booth — Changelog
=================

## Unreleased

### Runtime

- `kath run`, `kath build` and `kath doctor`, so one command builds a source
and runs it on whatever device is there (Zane Hambly, 2026-09-14)

### Backends

- `--nvidia-cubin` writes a cubin the card will load, with no NVCC anywhere in
the chain. All 67 of ggml-cuda's files now reach the IR
(Zane Hambly, 2026-09-09)

### Frontend

- `constexpr` and `const` objects fold at every use, and anything the folder
cannot evaluate refuses with E128 (Zane Hambly, 2026-09-03)

- class templates, specialisations, default template arguments and
`enum class` parse, so 47 of ggml-cuda's 67 files reach the lowerer
(Zane Hambly, 2026-09-04)

- the lowerer's tables no longer run out of room on a large translation unit,
taking ggml-cuda's lowering errors from 774 to 210 (Zane Hambly, 2026-09-04)


## Booth 0.5.3

### Runtime
Expand Down
35 changes: 24 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CFLAGS = -std=c99 -MMD -MP -Wall -Wextra -pedantic -O2 \
-Wdouble-promotion -Wswitch-enum -Wwrite-strings \
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIE $(CF_PROT) \
$(GCC_ONLY) \
-Isrc -Isrc/fe -Isrc/ir -Isrc/tdf -Isrc/backend -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/metal -Isrc/intel -Isrc/triton -Isrc/cpu -Isrc/build -Iruntime/include \
-Isrc -Isrc/fe -Isrc/ir -Isrc/tdf -Isrc/backend -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/metal -Isrc/intel -Isrc/triton -Isrc/cpu -Isrc/build -Isrc/exec -Iruntime/include \
$(COVFLAGS)
LDFLAGS = -pie
LIBS = -lm
Expand Down Expand Up @@ -71,11 +71,14 @@ SOURCES = src/main.c src/kauri_impl.c \
src/amdgpu/amd_rplan.c src/amdgpu/isel.c src/amdgpu/emit.c src/amdgpu/ra_ssa.c src/amdgpu/encode.c src/amdgpu/enc_tab.c src/amdgpu/sched.c src/amdgpu/verify.c src/amdgpu/amd_be.c \
src/tensix/isel.c src/tensix/emit.c src/tensix/coarsen.c src/tensix/datamov.c src/tensix/noc.c \
src/tensix/rv_enc.c src/tensix/rv_buf.c src/tensix/rv_elf.c src/tensix/rv_isel.c src/tensix/tensix_be.c src/cpu/cpu_emit.c src/cpu/cpu_elf.c src/cpu/rv64_emit.c src/cpu/rv64_elf.c src/cpu/cpu_be.c \
src/nvidia/isel.c src/nvidia/emit.c src/nvidia/nv_be.c \
src/nvidia/isel.c src/nvidia/emit.c src/nvidia/nv_be.c src/nvidia/emit_sass.c src/nvidia/verify.c \
src/nvidia/lt_nvi.c src/nvidia/lt_nv.c src/nvidia/lt_nvcf.c src/nvidia/nv_note.c \
src/metal/emit.c src/metal/metal_be.c \
src/intel/emit.c src/intel/intel_be.c \
src/triton/lex.c src/triton/parse.c src/triton/sema.c src/triton/lower.c \
src/mlir/mlir_fe.c src/mlir/lower.c
src/mlir/mlir_fe.c src/mlir/lower.c \
src/exec/execs.c src/exec/cpu_exec.c src/exec/booth_run.c src/exec/verbs.c \
runtime/host/cuda/nv_rt.c runtime/host/cuda/nv_exec.c

# Certik's pure-C MLIR reader, vendored under src/mlir/vendor. It carries his
# corec base library and a syscall shim per host, so only one of the three
Expand Down Expand Up @@ -127,22 +130,22 @@ TARGET = kath
# strict flags without libhsa or libcuda having to be present. Neither is a
# trunner test; both carry their own main and want real hardware.
EXAMPLE_SRC = $(wildcard examples/*.c)
HOSTCHK = $(OBJDIR)/tests/tnv_rt.o $(OBJDIR)/tests/tnv_i1.o $(OBJDIR)/tests/tnv_bstr.o $(OBJDIR)/tests/gpu_mma.o $(patsubst examples/%.c,$(OBJDIR)/examples/%.o,$(EXAMPLE_SRC))

HOSTCHK = $(OBJDIR)/tests/tnv_rt.o $(OBJDIR)/tests/tnv_sass.o $(OBJDIR)/tests/tnv_i1.o $(OBJDIR)/tests/tnv_bstr.o $(OBJDIR)/tests/tnv_sret.o $(OBJDIR)/tests/tnv_call.o $(OBJDIR)/tests/tnv_grid.o $(OBJDIR)/tests/gpu_tid.o $(OBJDIR)/tests/gpu_mma.o $(OBJDIR)/tests/gpu_wmma.o $(OBJDIR)/tests/gpu_hcvt.o $(patsubst examples/%.c,$(OBJDIR)/examples/%.o,$(EXAMPLE_SRC))
all: $(TARGET) $(ALT_RT) $(HOSTCHK)

$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(DL_LIB)

$(OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@

# ---- Test Suite ----
TCFLAGS = -std=c99 -MMD -MP -D_POSIX_C_SOURCE=200809L -Wall -Wextra -O0 -g \
-Isrc -Isrc/fe -Isrc/ir -Isrc/tdf -Isrc/backend -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/metal -Isrc/intel -Isrc/triton -Isrc/cpu -Isrc/build \
-Isrc -Isrc/fe -Isrc/ir -Isrc/tdf -Isrc/backend -Isrc/amdgpu -Isrc/tensix -Isrc/nvidia -Isrc/metal -Isrc/intel -Isrc/triton -Isrc/cpu -Isrc/build -Isrc/exec \
-Isrc/mlir -Iruntime/include $(COVFLAGS)
TSRC = tests/tmain.c tests/tsmoke.c tests/tcomp.c tests/tenc.c \
tests/tasy.c \
tests/ttabs.c tests/ttypes.c tests/terrs.c tests/tphase.c \
tests/tdce.c \
tests/tcfold.c \
Expand Down Expand Up @@ -171,7 +174,12 @@ TSRC = tests/tmain.c tests/tsmoke.c tests/tcomp.c tests/tenc.c \
tests/tbir.c \
tests/tocm.c \
tests/tpack.c \
tests/tmtu.c
tests/tmtu.c \
tests/tcxp.c \
tests/ttpl.c \
tests/tvec.c \
tests/tref.c tests/ttyc.c tests/tcpp.c \
tests/tmof.c tests/tasm.c

TOBJS = $(TSRC:%.c=$(OBJDIR)/%.o)
COBJS = $(OBJDIR)/src/kauri_impl.o $(OBJDIR)/src/ir/bir.o $(OBJDIR)/src/ir/bir_print.o $(OBJDIR)/src/ir/bir_lower.o $(OBJDIR)/src/ir/bir_mem2reg.o $(OBJDIR)/src/ir/bir_cfold.o $(OBJDIR)/src/ir/bir_dce.o $(OBJDIR)/src/ir/bir_struct.o $(OBJDIR)/src/ir/bir_insert.o $(OBJDIR)/src/ir/bir_sroa.o $(OBJDIR)/src/ir/bir_inline.o \
Expand All @@ -185,14 +193,19 @@ COBJS = $(OBJDIR)/src/kauri_impl.o $(OBJDIR)/src/ir/bir.o $(OBJDIR)/src/ir/bir
$(OBJDIR)/src/amdgpu/amd_be.o $(OBJDIR)/src/nvidia/nv_be.o \
$(OBJDIR)/src/tensix/tensix_be.o $(OBJDIR)/src/cpu/cpu_be.o \
$(OBJDIR)/src/metal/metal_be.o $(OBJDIR)/src/intel/intel_be.o \
$(OBJDIR)/src/nvidia/isel.o $(OBJDIR)/src/nvidia/emit.o \
$(OBJDIR)/src/nvidia/isel.o $(OBJDIR)/src/nvidia/emit.o $(OBJDIR)/src/nvidia/emit_sass.o $(OBJDIR)/src/nvidia/verify.o \
$(OBJDIR)/src/nvidia/lt_nvi.o $(OBJDIR)/src/nvidia/lt_nv.o $(OBJDIR)/src/nvidia/lt_nvcf.o $(OBJDIR)/src/nvidia/nv_note.o \
$(OBJDIR)/src/cpu/cpu_emit.o $(OBJDIR)/src/cpu/cpu_elf.o \
$(OBJDIR)/src/cpu/rv64_emit.o $(OBJDIR)/src/cpu/rv64_elf.o \
$(OBJDIR)/src/tensix/isel.o $(OBJDIR)/src/tensix/coarsen.o $(OBJDIR)/src/tensix/datamov.o \
$(OBJDIR)/src/metal/emit.o $(OBJDIR)/src/intel/emit.o \
$(OBJDIR)/src/mlir/mlir_fe.o $(OBJDIR)/src/mlir/lower.o $(VSOURCES:%.c=$(OBJDIR)/%.o)

rules:
@sh tests/rules.sh

test: $(TARGET) trunner
@sh tests/rules.sh
./trunner --all

# bir.h claims a deterministic layout. This makes that a property rather
Expand Down Expand Up @@ -310,7 +323,7 @@ coverage:

clean:
rm -rf $(OBJDIR) $(COVDIR)
rm -f $(TARGET) $(TARGET).exe trunner trunner.exe tnv_rt tnv_rt.exe
rm -f $(TARGET) $(TARGET).exe trunner trunner.exe tnv_rt tnv_rt.exe tnv_sass tnv_sass.exe
rm -rf coverage.txt coverage-html
rm -f *.hsaco *.ptx *.spv *.metal *.elf *.bin *.ttinsn *.o
rm -f *_host.cpp *_reader.cpp *_writer.cpp *_compute.cpp
Expand All @@ -320,4 +333,4 @@ clean:
# linked in and the build silently disagrees with the source.
-include $(OBJECTS:.o=.d) $(TOBJS:.o=.d) $(HOSTRT:.o=.d)

.PHONY: all clean test repro mutate mutate-discover install uninstall coverage hostchk
.PHONY: all clean test rules repro mutate mutate-discover install uninstall coverage hostchk
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ It is named to honour Kathleen Booth: creator of the first assembly language, co

A running log of what's changed is in [CHANGELOG.md](CHANGELOG.md).

**Update:** GPU kernels can be written as ordinary OCaml functions. `ocamlc`
does the type checking, so writing an `int` where a 32-bit device integer
belongs, or reading a block-shared array as if it were global, fails before
Booth sees it. An Asian option pricer written this way runs on an RTX 4060 Ti
and agrees with its closed-form reference. See [Using OCaml](docs/usage.md#ocaml).
**Update:** ggml-cuda, the CUDA half of llama.cpp, now lowers. All 67 of its
files reach Booth's IR, and 47 of its kernels go through the new native SASS
backend, which writes a cubin the card loads directly. Until now NVIDIA meant
PTX and the driver's JIT. Try it with `kath --nvidia-cubin`. And I never want
to have to read a machine dump ever again, lmao omg it's been rough.

## What It Does

Expand Down
Loading
Loading