Use your Nvidia GPU's VRAM as swap space on Linux
79 points by tanelpoder 2 hours ago | 22 comments

yjftsjthsd-h 2 hours ago
> Built for laptops with soldered memory and no upgrade path. If you have an RTX card sitting there with 8GB of VRAM and you're getting swapped to SSD, this puts that VRAM to work.

Well, that does at least answer my immediate question about why I would ever swap from expensive RAM to really expensive RAM:) Feels niche, but when you want it it's a good idea.

reply
Wowfunhappy 5 minutes ago
Another possible reason that occurred to me: what if you have VRAM but you're not using it all the time? For example, let's say you bought a GPU because you like to play video games. When you're not actively gaming, you probably don't need 16 GB of VRAM just to render the desktop. Might as well use it for something else, right?
reply
xfalcox 59 minutes ago
Given my dev machine has 32GB of RAM and 32GB of VRAM that sits mostly idle when I'm not running AI models, this is not that bad of an idea.
reply
RachelF 19 minutes ago
Nice idea, but something has gone very wrong here:

>Sequential throughput: ~1.3 GB/s

[on a RTX 3070 Laptop]

This RTX 3070 chip is on PCIe 4.0 x16 which should give 64GB/s. The 8GB of GDDR6 is 448GB/s.

Swapping to an NVMe drive would be twice as fast, but with higher latency.

reply
dragontamer 40 minutes ago
Remember how 16GBs used to be an enterprise level database mainframe?

Well, GPUs also have stupid amounts of compute on them. I have to imagine that there is some kind of database format that's useful with GPU compute attached.

Since the data is already in VRAM, the GPU can sort, join, or otherwise manipulate data as needed.

reply
einichi 8 minutes ago
oh god please don't create more demand for GPUs
reply
Nate75Sanders 16 minutes ago
Possibly LSM compaction.
reply
usxr1515 3 minutes ago
Nice
reply
willis936 31 minutes ago
I'm more interested in the opposite. Nvidia linux drivers crash when you try to address more VRAM than you have. It'd be nice if they didn't.
reply
SV_BubbleTime 21 minutes ago
They already do that on windows and it kinda sucks. If you are targeting something like LMStudio or ComfyUI, both of those have superior methods to do exactly this.
reply
LouisvilleGeek 17 minutes ago
Finally a use for the expensive ram when it's not needed in workloads!

Now if it could be dynamically used and vacated on other GPU workloads?

reply
UnfitFootprint 16 minutes ago
No software benchmarks? BAR for RAM is cool but I want to see how much it _actually_ beats pcie nvme
reply
hardwaresofton 38 minutes ago
You want to waste VRAM, in this economy?
reply
jcmfernandes 2 hours ago
Q: Why? A: Why not?
reply
effnorwood 22 minutes ago
use your car for an anchor on a big boat!
reply
SV_BubbleTime 20 minutes ago
I mean, if you aren’t using the car while using the boat and it won’t really damage the car… yes?
reply
bobsmooth 23 minutes ago
RAM disks have always fascinated me. In a different timeline every PC has a 100gb of RAM and 50TB HDDs are the norm.
reply
pixl97 3 minutes ago
Back when HDDs were all there was ramdisks were interesting, but SSDs pretty much killed most of that as they have massively increased IOPS over disks.

Hard drives that huge scare me as it would take days to backup all the data off them.

reply
simonask 2 hours ago
I mean, cool, but I’d rather not?
reply
margalabargala 57 minutes ago
So don't. Not everything is for you.
reply
gchamonlive 57 minutes ago
Wouldn't it be faster to swap to vram if you are sitting there with 8gigs of it unused than swapping to ssd and burning its write cycles, assuming you absolutely need swap
reply
dspillett 2 hours ago
So, erm, don't?
reply
Sohcahtoa82 2 hours ago
[dead]
reply