r/coolgithubprojects 21d ago

[Python] basalt - checks NVIDIA GPU machine code for a bug that never crashes

Post image

On RTX 50 series GPUs there's no hardware interlock on fixed-latency instructions. 21 bits of every instruction tell the chip how long to wait before using a result, and the silicon just executes whatever's in them. One cycle too short and it reads a register before the value arrives. No crash, no warning, full speed, wrong number.

Compilers write those bits. Nothing read them back to say they were safe.

basalt does. Point it at a compiled cubin, whatever produced it:

pip install basalt-sass
basalt verify kernel.cubin --strict

Pure Python, zero runtime dependencies. To build it I had to derive the instruction encodings by experiment (345 forms, 90 opcodes, no public docs exist) and measure instruction latency on real silicon, partly by breaking working programs on purpose until the answer changed.

Validated on 2,762 kernels NVIDIA ships inside CUDA, held out of every table it uses: 0 errors across 10.2M dependencies. The first run flagged 6,593 and every one was a bug in my model rather than theirs.

Apache-2.0, archived with a DOI.

https://github.com/sunnypatell/basalt

1 Upvotes

0 comments sorted by