VRAM Allocation Issues

Interesting. I thought it was just me. Doesn’t seem to be a problem with native games, but definitely is with any dxvk or vkd3d game.

Alt-tabbing in a game or loading a different area causes it to happen faster.

Operating System: Slackware-current (64-bit)
xfce4, 4.18
Kernel Version: 6.6.21
Graphics Platform: X11
Graphics Processor: GeForce GTX 1050ti (4GB vram), 550.54.14

I have a similar issue, but for me mostly the apps will report out of memory (so for RDR2, Doom 2016, stable diffusion and a few others)

2024 and I found to have the same issue with my rtx3050 mobile

±--------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.08 Driver Version: 535.161.08 CUDA Version: 12.2 |
|-----------------------------------------±---------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3050 … On | 00000000:01:00.0 Off | N/A |
| N/A 50C P0 17W / 80W | 189MiB / 4096MiB | 5% Default |
| | | N/A |
±----------------------------------------±---------------------±---------------------+

Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 4096 MB
Total available memory: 4096 MB
Currently available dedicated video memory: 3696 MB

I get actually crashes in games and and also with stable diffusion (running out of memory)

funnliy when i bought the laptop (ASUS-TUF-Gaming-F17-FX707ZC4), everything ran well with the old 535 driver, but since the last two updates, it is now broken for me.

Hi all.
So same problems…
And Yes this is very annoying this missing option to be able to Enable or Disable the memory RAM / VRAM sharing
under linux. Please Nvidia force this option on Linux to be always activated on linux at the the build levels of the drivers and the option became Checkable on the nvidia-settings Gui or in the nvidia-smi utils like on windows.
Thanks again.

This is such a major issue. Is this ever going to get fixed? I’m running the latest 550 driver, and this is still an issue. I’ve tested games in Windows and run them at max settings; the game is using maximum vram usage spilling over into system RAM, and I never get framedrops like what I get under Linux, games where I easily get 60 fps on Windows. Even with max vram usage is dropping into the single digits on Linux when vram is maxed, you might get some micro stuttering in Windows but never ever single digit fps.

Its not just gaming. If I have many application windows open dedicated memory usage increases up to total available dedicated memory and there is overall desktop performance penalty, like windows compositing feels sluggish. Under such conditions there is also CUDA_ERROR_OUT_OF_MEMORY when playing 4K HDR video using mpv player with hwdec=nvdec, which plays just fine when I close some browser windows and electron apps.
I have optimus laptop and this is definitely nvidia driver releated becouse with intel integrated GPU issues do not arise.
nvidia-bug-report.log.gz (1.8 MB)

3 Likes

Same experience for me. Integrated Intel actually works fine, while the dedicated Nvidia card is failing.
This is a mess

Somebody tried this already?

15.10.2. Install GPUDirect Storage Support for the NFS Client

AS I understand it can reroute to system memory (one of the options)

gtx 1650 4gb vram

nvidia, why cant you just add shared vram, its going to make linux ligher then windows, please just add it, please i really need it
i cant afford new gpu and on windows i get over 60fps and on linux i only get 20-30fps becouse of Non-existent shared VRAM

[ 2878.849654] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.067285] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.067334] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.079956] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.079997] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.135007] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.135046] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.364551] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2881.364596] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2895.020824] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2896.955671] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object
[ 2896.955720] [drm:nv_drm_gem_alloc_nvkms_memory_ioctl [nvidia_drm]] *ERROR* [nvidia-drm] [GPU ID 0x00000100] Failed to allocate NVKMS memory for GEM object```

4GB GPU can play the same game in Window. Just can’t do in Linux.
Even 3GB 1060 can play any game without problem including heavy game Remnant2.
Whenever any game uses 3.8GB VRAM, that is when problem start, cannot play the game at all. But the same game in Window never reaches 3.8GB.

1 Like

The reason why the game uses more memory in Linux is probably because of the graphics pipeline library used by Vulkan in dxvk/vkd3d-proton.

Regarding shared memory, I can only share what James said here

The tool is nvidia-smi calculates VRAM usage. Mangohud also report the same results. Does not include system RAM.

Is not only games cause problem. Is when VRAM fills up. There are reports of users without playing games.
look at another thread here.

There have been reports by users, that not because vulkan using more RAM. AMDGPU users does not have this problem running vkd3d even when VRAM fills up. Windows driver also does not either.

I can confirm the issue. Apparently the NVIDIA GPU does not use system RAM when VRAM fills up. On Wayland it results in inability to open new windows or applications (e.g chromium, firefox, qt apps) when VRAM fills up. It could be reproduced on a high resolution screen by opening multiple windows of Firefox (at some point the windows become unresponsive)

2 Likes

Yes, this is exactly the issue. It sucks once you run out of vram; the application becomes super sluggish, then either freezes or crashes, and you can’t open anymore apps on the GPU at all because it’s vram is full. You can’t even screen record with obs; it gives vram allocation errors. This doesn’t apply to me, but if your entire desktop environment runs on the NVIDIA GPU, then your entire desktop can crash.

@JamesJones
It seems you need to clarify your post, you say Nvidia GPUs can use system RAM, while that might be true for the hardware itself, it seems like it doesn’t do that when using Linux.

This is still an issue with drivers 565.57.01

I see that a lot of people have problems playing with Proton.
Here’s a workaround:

Set a VRAM value by configuring DXVK to impose a usage limit.
Create a dxvk.conf file in your game folder, where the exe is located.
Add the line: dxgi.maxDeviceMemory = 0
Change the “0” to a value lower than your total VRAM to leave space for your system.
Check your system load with nvidia-smi in a console.
Keep some margin.

Your system should now behave properly and your gameplay should be smooth and stutter-free.
Good game to all.

Thank you for that solution for dxvk.
However, it didn’t fix the main problem:
Why nvidia gpus cannot just use system RAM in linux as it did in windows or like amd ones in linux?
I do know that there’re specific solutions for X11, and uvm seems available for pytorch(but I never got it to work), but that didn’t make it unnecessary for nvidia to neglect this feature(It just made everything unnecessarily complex)

For most games, DXVK will try to load a configuration file into the directory where the logs are located, the directory where the game’s EXE is located most of the time. But this is not true for all games. If this doesn’t work with a dxvk.conf file in the directory where the EXE is located, try the following:

Place your dxvk.conf file in your user folder:
/home/xxx/dxvk.conf
Replace xxx with your username.

Add an environment variable:
DXVK_CONFIG_FILE=/home/xxx/dxvk.conf
On Debian, edit the etc/environment file and add the line above.
Note that this will automatically load the configuration file for all games under DXVK .
Restart the system.

These explanations are partly taken from the DXVK project:
https://github.com/doitsujin/dxvk/wiki/Configuration#configuration-file
You can find the list of all applicable variables here:
https://github.com/doitsujin/dxvk/blob/master/dxvk.conf

This is by no means a stable method to fix an Nvidia driver problem and will never replace an update by Nvidia in order to fix it permanently. Nevertheless, I tested this method on about ten games, and it always worked. It is possible that it does not work on some games, not having had the centuries necessary to test them all, but if you are in this case, I hope you will keep your heart for a future optimized driver.

1 Like

I also have a 3070, and have found that things crash as soon as they go above the 8GB of vram, whether that be a single app, or apps sharing the card.

However, as an additional detail, when I look in KDE System Monitor, at the GPU 2 Total Video Memory sensor, it claims 16GB of VRAM. The crash would make sense if the driver is reporting more VRAM than the card has. Naturally, applications will try to allocate memory that they think is there, and would then receive an error saying it couldn’t allocate.

Could the problem be something as small as the driver for the 3070 is simply configured with the wrong amount of VRAM? If so, are some other cards configured with incorrect VRAM?

Is there any way to override the driver to set a custom value for the VRAM?

Running nvidia-open-dkms 565.77-1
Same issue on nvidia-dkms 565.77-1

Is there any further information? Lacking of the ability to use system ram like windows really limited the performance of the gpus with linux.