Use your Nvidia GPU's VRAM as swap space on Linux
Tool allows Linux users to allocate unused GPU VRAM as swap space via NBD protocol, targeting laptops with soldered memory.
nbd-vram is a userspace daemon that allocates NVIDIA GPU VRAM and exposes it as a block device through the Network Block Device protocol, then configures it as Linux swap. Built for hybrid-graphics laptops where the display uses integrated graphics and the NVIDIA card sits idle. A test case allocated 7 GB of VRAM on an RTX 3070 laptop (8 GB total), tripling addressable memory to 46 GB when combined with zram and SSD swap.
The daemon sidesteps NVIDIA's P2P API restrictions on consumer GPUs by using CUDA's cuMemcpyHtoD/DtoH functions through a Unix socket instead. Performance benchmarks on RTX 3070 show VRAM swap achieves 27x lower latency than NVMe swap at sporadic 1 request/second access (335 us vs 9.05 ms average), though sequential throughput is slower (1.1 GB/s write vs 2.7 GB/s on NVMe). Installation requires NVIDIA driver, Linux kernel 3.0+, nbd-client, and gcc.
What HN community is saying
Commenters recognized the niche use case, particularly for hybrid-GPU laptops where discrete VRAM is unused during display composition. The author confirmed this as the motivation. Discussion of alternatives centered on power management concerns and whether VRAM can be dynamically released when gaming demands it. One commenter noted the sequential throughput of 1.3 GB/s significantly underutilizes PCIe 4.0 x16 bandwidth (64 GB/s theoretical). Questions arose about applying similar techniques to unused dedicated GPU memory in mixed-use scenarios like AI development.