Having worked briefly on GPU drivers (amd ex-ati) I'm curious how this can be done. There were myriad details inside that code that related directly to particular controls deep in the basics (micro cache enables, chicken bits, N-1 toggles, memory access radices, etc). Many of them were set once, not dynamically. And clearly not documented anywhere outside HQ. And almost none had a visible effect...until a long chain of operations caused a fantastic crash, or trivial one. Experienced people spent months with the manual, fancy tooling, and the hdl and the designers downstairs to get it shippable and then time was spent after shipping.
I would say you can scan 100s of games to see how they operate the hw...but many games have individual engs assigned to work w game devs to hash out configs down long trees of operations... this feels like learning Chinese with almost no feedback. There are so many parts/corners of the internals that get manipulated.
I could see moving from "one clone of every apps' code" to "common parts distilled," but what are the chances it could be reliable with code it hasn't been trained on that uses a novel feature?
>> And clearly not documented anywhere outside HQ.
One user with the email [email protected] leaked the internal docs
For modern drivers, I believe all those fiddly bits have essentially been moved into the firmware. Nvidia is packing them all into the GSP. That remains an impenetrable binary blob.
There was already a big leak of proprietary NVIDIA driver source a few years ago. Overall there’s probably lots of information out there.
> There were myriad details inside that code that related directly to particular controls deep in the basics (micro cache enables, chicken bits, N-1 toggles, memory access radices, etc). Many of them were set once, not dynamically.
A bit of a tangent, but: do you have any idea why these things get handled in the GPU driver in the first place, rather than the GPU having firmware that does its own bring-up into a useful state before it ever starts letting the CPU talk to it?
Maybe nvidia's cards are slightly more logically setup? The nouveau driver works reasonably well for a lot of older cards as well so it's not like it is completely unknown.
And let's be honest. AMD has a reputation for their driver being quite bad/incomplete . Your description sounds like even AMD themselves did not really have a good overview of what the engineering department had cooked up either, which kinda matches that reputation.
this is kinda ancient history, but I remember old GeForce cards used to implement the OpenGL state machine, with every command submitted to the GPU matching an OpenGL call, parameters and all.
a lot, but not all of the docs are public: https://nvidia.github.io/open-gpu-doc/
That and the existing kernel driver is already open source.
Same docs they use internally. I remember.
Considering https://github.com/QuixiAI/nvdriver/blob/master/AGENTS.md specifically mentions decompiling the proprietary driver I assume that was used as a reference for stuff like that.
And makes me wonder what the author thinks "clean room" means.
If they followed the usual open source conventions, what would happen is they'd write the driver the way they think the hardware ought to work, and if it fails, they'd blame Nvidia and tell the user to complain to the people who made broken hardware.
Most likely they just prompted an LLM "port Nvidia driver to rust. make it clean-room"
I assume it is like those other projects that told the llm to do "clean room".
Perform static analysis and then dynamic analysis; in many ways it's a lot easier than forward engineering drivers since the weird sequencing issues and errata that always come up are already fixed. Stuff like "which chicken bits to set" and "what clock/power domain blows the other one up if you get the ordering wrong" doesn't cause issues, since the instrumented traces and analyzed code already do everything in the right order.
Usually the way this is done by hand (and reading the source for this driver, it looks like Claude did things about the same way) is:
* Statically analyze enough of the system to understand how commands (mapped registers, mailboxes, buffers) are sent and structured at the highest level.
* Write a dynamic analysis tool which can trace the state changes sent to the hardware (ie - dump every register poke, every mailbox, every buffer)
* Dump enough of the bring-up to be able to do it yourself, even if you don't understand it (ie - these 500 registers need to be set to these values for "normal operation," we have no idea what they are, but we know how to poke them and in what sequence).
* Use static analysis to try to back out the meaning of each register/buffer and to define structures (ie - "this register has bit x set to y in a function called EnableFooClockDomain, it must be the FOO_CLK_EN bit" or "this structure is allocated in AllocateBigTransferBufferA, the type of this structure is clearly a big_transfer_buffer_a"). If you don't know what the functions are called, name them using context clues (observed logging, where in time said function is called, known values in the inputs, etc.)
Then you basically rinse and repeat this process using techniques like fuzzing observed inputs->outputs, tracing known constants, and finding context clues from documentation and parallel architectures.
The Asahi Linux RE process is a good way to understand how this kind of hardware RE worked pre-LLMs (and how LLMs learned to do it); they first constructed a hypervisor (m1n1) for the OS, then instrumented how the OS manipulated the hardware, then fuzzed the inputs to the OS to understand the resultant hardware-state-communication outputs.
I also doubt this driver will get too far down the game specialization rabbit hole, so they don't need to know quite as much; they seem to be targeting mostly basic display acceleration and GPGPU, so the stack of hacks isn't quite as tall.
> learning Chinese with almost no feedback
Perhaps you should take a read of https://en.wikipedia.org/wiki/Chinese_room which is the thought experiment about AI and true understanding vs regurgitation.
You can understand the symbols even if you don't understand the meaning.
"Clean room" is doing a lot of lifting here without any evidence.
Not a clean answer but: back in the day Naveen Rao and Nervana Systems beat nVidia at BLAS https://news.ycombinator.com/item?id=20490050
LLMs today probably greatly accelerate the tedious parts of "reverse-engineering"
> chicken bits
Oh TIL
> A bit on a chip that can be used to disable one of the features of the chip if it proves faulty or negatively impacts performance
That's all in the firmware. This is a copy paste from the open source Nvidia driver.
Binary files are no different than sourcecode for LLMs. I had jaw drop moment when I thought I'll attach firmware and ask LLM why it shows certain message on LCD. I told it what CPU was used and got an answer promptly. It even listed some bugs which I then tried on the device and they were indeed happening.
I am now thinking of telling my LLM to decompile all the blobs in RaspberryPi just because why not.
> scan 100s of games
I see zero indication in the docs that the authors care about games, or indeed video output at all. The target use cases are headless: LLM inference and crypto mining.