This repository was created to answer a question of how much a full desktop operating system gets in the way of LLM TPS. GPUOS is an x86_64 UEFI application that uses the real NVIDIA driver to talk to the GPU and a harness from running Llama-3.2-1B.
Hardware configuration used in benchmarks
CPU: AMD Ryzen 9 9950X @ 5.76 GHz
GPU: NVIDIA GeForce RTX 4070
RAM: 32 GiB DDR5 @ 5200 MHz
OS: Ubuntu 26.04.1 LTS
Kernel: Linux 7.0.0-44-generic
Benchmark results across environments
The benchmark with the adapted Llama harness is run under three environments:
- Linux Userspace (Linux)
- As an UEFI app under KVM with GPU passed through via VFIO (VM)
- As a baremetal UEFI application booted directly on the CPU (UEFI)
Median TPS across these environments:
| Linux | VM | UEFI |
|-------|----|------|
| 163.5 | 163.6 | 164 |
Linux and VM are effectively the same, while there's only a slight (and consistent) 0.5 TPS improvement in the baremetal environment. The slight TPS regression in the Linux/VM environment is believed to be purely an artifact of context switching.
Dependencies and build tools
- gcc and binutils (ld, objcopy)
- gnu-efi (Ubuntu/Debian: apt install gnu-efi)
- NVIDIA CUDA toolkit, for nvcc (compiles the GPU kernels to cubin)
- mtools (mcopy) and dosfstools (mkfs.vfat)
- git, and curl or wget
- For the VM target: qemu-system-x86_64 and OVMF (ovmf package)
Building GPUOS
GPUOS statically links NVIDIA's open GPU kernel driver and loads a GGUF model at runtime. Neither lives in this repo. Fetch both with:
./setup.sh
This clones NVIDIA/open-gpu-kernel-modules pinned to 620.73.04 into ../open-gpu-kernel-modules (a sibling of this repo, which is where the Makefile expects it), and downloads the Llama-3.2-1B-Instruct F16 GGUF into models/. It also reports any missing build tools.
make # the UEFI application: build/BOOTX64.EFI and build/gpuos.img (EFI only)
make llm-img # bootable image bundling the app, the weights and the GPU kernels
make llm-img produces build/gpuos_llm.img, a FAT32 image sized to the model. It places the EFI app at /EFI/BOOT/BOOTX64.EFI and the GGUF plus llama.cubin at the filesystem root, which is where the app reads them from the boot volume at runtime. Use a different model with make llm-img GGUF=/path/to/model.gguf.
QEMU VM configuration for GPU passthrough
Bind the GPU (both functions) to vfio-pci first, then:
cp /usr/share/OVMF/OVMF_VARS_4M.fd build/OVMF_VARS.fd
sudo qemu-system-x86_64 -machine q35,accel=kvm -cpu host,-x2apic -enable-kvm -m 8G -no-reboot \
-drive if=pflash,format=raw,unit=0,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
-drive if=pflash,format=raw,unit=1,file=build/OVMF_VARS.fd \
-drive format=raw,file=build/gpuos_llm.img \
-device vfio-pci,host=0000:01:00.0,multifunction=on \
-device vfio-pci,host=0000:01:00.1 \
-display none -serial null -serial file:serial.log
The passed-through GPU drives its own attached monitor. To type at the interactive prompt, pass a USB keyboard through too, for example:
-device qemu-xhci,id=xhci -device usb-host,bus=xhci.0,vendorid=0xVVVV,productid=0xPPPP.
Running the benchmark
make llm-img
sudo dd if=build/gpuos_llm.img of=/dev/sdX bs=16M oflag=direct status=progress
Replace /dev/sdX with your USB device (this erases it), then boot it from the firmware boot menu. Use a USB keyboard to interact.
At the > prompt, type a message and press Enter to chat. Type [[benchmark]] to run the prompt suite and print the median TPS. Type /quit to exit.