Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens when VRAM is full?

I want to know the current nvidia/AMD implementation of handling VRAM resource allocation.

We already know that operating systems use swap/virtual memory when system RAM is full, then what is the equivalent of swap when it comes to VRAM? Do they fall back to system RAM or hard disk?

I thought that falling back to system RAM is rational, but from my experience video games lag horribly(1/20 of typical FPS) when they are out of video memory space, that made me doubt that they are using system RAM because I think system RAM is not that slow to make the game lag so much.

In short I would like to know what the current implementations are and what is the biggest bottleneck that causes the game to lag under out-of-memory situations.

like image 264
manatails Avatar asked Apr 25 '15 12:04

manatails


1 Answers

  1. the swapping is really done to RAM

    if there is enough RAM to swap to. Swapping to file is unusable due to slow speed see next bullet

  2. The RAM it self is not that slow (still slower) but the buses connected to it are

    while swapping system memory to swap file the memory swap occur when needed (change focus of application,open new file/table,...) this is not that frequent but if you are out of VRAM then you are in trouble because usually most of gfx data is used in each frame.

    This leads to swapping per frame so you need to copy usually very large data blocks very often for example swapping 256MB 20fps leads to:

    256M x 2 x 20 = 10 GB/s read
    256M x 2 x 20 = 10 GB/s write
    

    which is 20GB/s bandwidth needed of coarse depending on the memory controller and architecture You can do read/write simultaneously up to a point so you can get close to 10GB/s in total theoretically but still that is huge number for only 256MB chunk of data look here:

    • Cache size estimation on your system?

    My setup at that time has memory write only around 5GB/s which is nowhere near the needed memory transfer rate needed for such task

like image 93
Spektre Avatar answered Nov 15 '22 07:11

Spektre