# This Rust Nvidia driver isn't clean-room. It's a diff against the blob.

> Source: <https://dev.to/ianwieds/this-rust-nvidia-driver-isnt-clean-room-its-a-diff-against-the-blob-447d>
> Published: 2026-12-01 00:12:00+00:00

**Recommendation:** Build an oracle from recorded binary behavior and replay it in a disposable VM so agent-written code gets checked against exact test vectors instead of live hardware.
More in the playbook "Evals and testing for LLM apps": <https://wpnews.pro/playbooks/evals-testing>

Step two of the seven-step loop in nvdriver's agent rules tells the coding agent to decompile the matching function in Nvidia's closed 580.178.04 driver before it writes any Rust. Every function.

The first line of the README calls the result clean-room.

Both can't be true, and Monday's Hacker News thread (#1, 767 points, 383 comments) spent most of its energy on that gap. I think the argument buried the more interesting part: the method they actually used is new, it's checkable, and it says a lot about what Rust does and doesn't buy you inside a kernel.

[nvdriver](https://github.com/QuixiAI/nvdriver) builds `nvidia_rs.ko`, a Linux kernel module written mostly in Rust. It aims to replace Nvidia's kernel driver while you keep Nvidia's own closed userspace on top: `libcuda`, `nvidia-smi`, PyTorch, NCCL. Eric Hartford (QuixiAI) made the repo public on Nov 27, and it passed 1,600 stars by Monday afternoon.

I did not build it or load it. I cloned the source read-only, read the docs, the issues and the thread, and counted. The tree holds about 312,000 lines of Rust on top of a 9,600-line C shim that does the Linux plumbing: PCI, character devices, DMA, hwmon.

Clean-room design is a legal process, not a vibe. One team studies the original and writes a specification of what it does. Someone checks that the spec carries no copied code. A second team that has never seen the original builds from the spec alone, so it can show it copied nothing. That's how the IBM PC BIOS got cloned in the 1980s.

nvdriver runs one loop, not two teams. Its rules say to work out the original function's struct layouts, offsets and error order from the disassembly, then implement the exact algorithm. The code shows it. Comments across the Rust name 4,408 distinct stripped symbols from Nvidia's binary, in the form `_nv031458rm`.

Hartford's answer in the thread was that reverse engineering and clean-room can coexist as long as the analysis and the writing stay separate. Several commenters asked who the two separate teams were. I didn't see that answered.

Newer contributors also work from Nvidia's own MIT-licensed open modules: an open pull request for the RTX 3090 says its port was matched call by call against them. That's firmer ground than a decompile, but it isn't clean-room either. The honest label is a reverse-engineered port. The repo also has no license file yet (issue #12 asks for one).

This is the part worth stealing. The `tools/` folder holds 99 `check_*_binary.py` scripts. Each one loads Nvidia's `nv-kernel.o_binary`, patches its relocations, and runs a few of the original x86 functions inside the Unicorn CPU emulator. Register reads are scripted, and every read, write and return value gets recorded. Those recordings become test vectors the Rust has to reproduce exactly. No GPU, no driver, no kernel.

Then the live half: record what the stock driver does on a real Tesla V100 for a workload (CUDA, cuBLAS, NCCL, video encode), replay the same steps against `nvidia_rs.ko` in a disposable VFIO virtual machine, and diff the results. A kernel hang costs a VM restart instead of a trip to the datacenter. The agent rules explain why that matters: an earlier hang left the 8-GPU test machine needing a power cycle.

So the promise isn't "we understood the hardware." It's "for these inputs, we do what Nvidia's binary does." That's a narrower claim, and a fair one when it's labeled that way. It's also how an agent can write 300,000 lines in weeks: the oracle tells it when it's wrong.

The layering is the best design decision in the repo. Here's what I counted in the clone:

``` bash
$ head -2 src/nvidia/src/lib.rs
#![no_std]
#![forbid(unsafe_code)]
src/nvidia/src: 484 files, 257264 lines, 3 x unsafe
src/nvidia/kernel: 80 files, 45622 lines, 1262 x unsafe
```

The three hits in the core are all in comments. About 85% of the Rust can't touch a raw pointer. Every MMIO access, DMA buffer and call into the C shim lives in the 45,000-line kernel layer, and the core reaches hardware through small traits. That's why its register sequences can run as ordinary unit tests against mock registers, and why the binary oracle works at all.

What Rust doesn't buy showed up within three days of launch. In issue #19, NCCL on four V100s corrupted AllReduce buffers above about 5 to 8 MB. The reporter traced it to `cuMemCreate` handing back video memory that still held the previous allocation's `0xdeadbeef`: the stock driver scrubs freed VRAM, and nvdriver didn't. That code sits in the safe core. In issue #2, a 16 GB V100 timed out during bring-up because the kernel layer hardcodes a scratch window near the top of a 32 GB card. Issue #4 reports the GSP boot path copying its command queue into DMA memory only after the handshake that needs it.

None of these is a memory-safety bug. Rust guards the CPU's memory. Video memory, register order and DMA timing are contracts with the hardware, and the compiler has never seen them.

| Driver | Code | Cards | Userspace | Built by | 
|---|---|---|---|---|
| nouveau | C, in mainline | Most generations, but stuck at boot clocks on Maxwell 2 to Volta | Mesa | Watching the blob's register traffic | 
| Nvidia open modules | C, out of tree | Turing and newer | Nvidia's CUDA | Nvidia | 
| Nova | Rust, upstream | Turing and newer, early | Mesa (NVK) | Kernel developers | 
| nvdriver | Rust, out of tree | Maxwell to Rubin claimed, V100 verified | Nvidia's CUDA | Decompile and diff | 

The gap it targets is real. Nvidia's open modules need the GSP firmware processor, so they never covered Maxwell, Pascal or Volta. nouveau runs those cards but can't reclock them, and it doesn't run CUDA. nvdriver is the only one aiming at "old datacenter card plus stock CUDA," which is exactly what a cheap secondhand V100 box wants.

Read the support table closely. The README's only real-silicon claim is Volta, from the author's eight V100-SXM2-32GB cards, and that's where every parity number comes from. Maxwell, Pascal and Turing through Rubin are marked as verified offline. Outside reports so far match that. A GTX Titan X bound on kernel 6.18 after two compat patches, then logged that engine init and CUDA were unavailable (issue #24). A Proxmox host with five GPUs loaded every module cleanly, but `nvidia-smi` reported GPU access blocked (issue #18).

Check the defaults too. On a V100 it raises the HBM2 memory clock out of the box (`v100_hbm_ndiv=82`), and it lets non-root users read hardware profiling counters (`unpriv_profiling=1`). Both are on unless you turn them off.

You can check my counts without building anything:

```
git clone --depth 1 --filter=blob:none --sparse https://github.com/QuixiAI/nvdriver
cd nvdriver && git sparse-checkout set src tools
grep -rwo unsafe --include='*.rs' src/nvidia/kernel | wc -l
```

If you have a V100 or a Pascal card collecting dust, what would a driver built by decompile-and-diff have to show you before you'd load it on a machine you care about?
