News for hackers. Stuff that matters.

jhuber6

Re:A CPU that runs entirely on GPU on Wednesday March 04, 2026 @01:06PM (#47251395)
Depends entirely on your definition of 'entirely', but https://github.com/jhuber6/doomgeneric is pretty much a direct compilation of the DOOM C source for GPU compute. The CPU is necessary to read keyboard input and present frame data to the screen, but all the logic runs on the GPU.
Re:Using Libc for GPUs on Sunday December 15, 2024 @02:08PM (#42425270)
At some point I was looking into using io_uring for something like this. The uring interface just works off of `mmap()` memory, which can be registered with the GPU's MMU. There's a submission polling setting, which means that the GPU can simply write to the pointer and the kernel will eventually pick up the write syscall associated with it. That would allow you to use `snprintf` locally into a buffer and then block on its completion. The issue is that the kernel thread goes to sleep after some time, so you'd still need a syscall from the GPU to wake it up. AMD GPUs actually support software level interrupts which could be routed to a syscall, but I didn't venture too deep down that rabbit hole.
Re:Using Libc for GPUs on Saturday December 14, 2024 @07:05PM (#42420414)
The RPC implementation in LLVM is an adaptation of Jon's original state machine (see https://github.com/JonChesterfield/hostrpc). It looks very different at this point, but we collaborated on the initial design before I fleshed out everything else. Syscall or not is a bit of a semantic argument, but I lean more towards syscall 'inspired'.
Re:Using Libc for GPUs on Saturday December 14, 2024 @06:28PM (#42420255)
Very cool to see my project posted here!

The motivation behind a lot of this was to have community LLVM implementations of runtime functions normally provided by the vendor libraries (C math, printf, malloc), but if you implement one function you may as well implement them all.

Realistically, the infrastructure behind this project is more relevant than the C library calls themselves. The examples in the linked documentation can be used for any arbitrary C/C++ just as well as the LLVM C library, it's simply statically linking. This is what allowed me to compile and run more complicated things like libc++ and DOOM on the GPU as well. The RPC interface can also be used to implement custom host services from the GPU, or used to communicate between any two shared memory processes.

Show HN: A port of DOOM that runs (almost) entirely on the GPU

https://github.com/jhuber6/doomgeneric

I've been recently working on porting standard C library functions to work on the GPU https://libc.llvm.org/gpu/. A colleague of mine suggested using it to run DOOM, so that's what I did. It runs on both AMD and NVIDIA GPUs and it is completely playable.This works by targeting C code directly for the GPU via cross-compilation in clang, looks something like this https://godbolt.org/z/hh44a6vKr....

( Read More... | 1 comment | 4 points | on HN )