Valve engineer shocks Linux community with game-changing VRAM hack for 8GB GPUs — breakthrough solution turbocharges gaming by prioritizing VRAM for games while background tasks take a back seat

Valve
(Image credit: Valve)

VRAM usage has become an increasingly unavoidable issue in games as they grow more graphically intensive over time. Pushing the visual fidelity requires more assets to be stored in VRAM, which makes it harder for cards with 8GB (or less) memory to run games smoothly. For Linux at least, Natalie Vock has just proposed a new solution that alleviates this issue, providing a notable performance boost for games by optimizing VRAM usage.

Vock is part of Valve's Linux graphics driver team; she's developed new kernel patches and two specific utilities to address the VRAM usage issue. These fixes basically talk to the OS and let it know that the game currently running in the foreground gets to call dibs on the VRAM. If the VRAM starts to fill up, any VRAM consumed by background tasks needs to spill over into system RAM before the game does.

Article continues below

Cybperunk 2077 VRAM usage in Linux with Vock's VRAM fixes versus without

(Image credit: pixelcluster)

The main solution she developed is called dmemcg-booster (Device Memory Control Groups), which tells Linux what program needs to be "protected" at any given moment, meaning it can't be evicted from the VRAM and thrown into the GTT. If a background task requires VRAM, it will be the one forced to move to slower system memory to ensure the game keeps running without interruption.

This is more about optimizing VRAM usage than outright reducing it. If you had a 12 GB card, for instance, you'd never notice the drawbacks of just 8 GB of VRAM because there's enough buffer for poorly prioritized background programs. Now, even a GPU with less VRAM can run at its full potential. Case in point: with the fixes applied, Cyberpunk 2077 started using almost 7.4GB of VRAM, and GTT dropped to just 650MB.

Cybperunk 2077 VRAM usage in Linux with Vock's VRAM fixes versus without

(Image credit: pixelcluster)

The other component is called plasma-foreground-booster, and it can automatically tell KDE which window is in front so that it can prioritize VRAM usage for that window. These patches are currently being integrated into CatchyOS and are awaiting merge into the main Linux kernel. You can download and use these patches yourself inside any distro, but keep in mind they'll only work on AMD GPUs because Nvidia drivers have closed-source memory management.

Google Preferred Source

Follow Tom's Hardware on Google News, or add us as a preferred source, to get our latest news, analysis, & reviews in your feeds.

TOPICS
Hassam Nasir
Contributing Writer

Hassam Nasir is a die-hard hardware enthusiast with years of experience as a tech editor and writer, focusing on detailed CPU comparisons and general hardware news. When he’s not working, you’ll find him bending tubes for his ever-evolving custom water-loop gaming rig or benchmarking the latest CPUs and GPUs just for fun.

  • Notton
    I'm guessing this would have been the fine wine moment for the Steam Machine, were they able to source RAM.
    Reply
  • QuarterSwede
    Shocked I tell you!

    Bah, do better.
    Reply
  • ezst036
    Valve is miles, miles ahead of Microsoft in terms of customer support and trust. This action highlights why.

    EDIT: Does Windows already do this VRAM functionality today? Perhaps it does and I suspect it does. The specific technical merits of this feature is not the point.

    Microsoft wants things, and customers want things. Microsoft prioritizes what Microsoft wants. That is the point. And what does Microsoft want? Copilot. We all know it.
    Reply
  • Math Geek
    no idea how it normally works, but these seems like common sense to me. prioritize what's actually on the screen vs something i can't see at the moment for my gpu to focus on.

    wonder how it works with dual screens. does the game still get first dibs on screen 1 and the youtube/discord/browser/monitoring software/etc get neglected on the second screen?

    just curious
    Reply
  • abufrejoval
    I only got more questions...

    First of all, showing a game console with an iGPU in this context is misleading, because there "VRAM" may be unified DRAM in that case, even if those tend to partition that into distinct pools with distinct policies, too.

    Second, I'd be surprised that VRAM on a dGPU is actually under (more than very basic) OS memory management control, so whatever an OS might want to do there, is likely to interfere with what a game may be doing and doing intentionally, because it's trying to emulate a real-time environment on a batch OS like Linux (or Windows etc.).

    Now, there may be some degree of collaboration between processes using a GPU that is even visible to the OS and mechanisms to ensure that VRAM is freed if a game exists, etc. But the OS managing VRAM almost as if it were DRAM, that's a rather big paradigm shift, I'd be very surprised to have missed completely. Here system DRAM would almost function as paging backing store to VRAM, no current OS is mentally ready or capable to take on this responsibility.

    If a game choses to push game content from VRAM to system memory (potentially mapped into the GPUs memory space), that sounds like a deliberate choice to me, that no outsider should interfere with, while game is running.
    Reply
  • Sam Hobbs
    abufrejoval said:
    Here system DRAM would almost function as paging backing store to VRAM
    I asked Perplexity AI about that before reading all the comments here. As best as I understand what it says, and I might misunderstand it. GPUs can use main memory like a paging device. The solution described here adds the additional criteria of background versus foreground.

    abufrejoval said:
    If a game choses to push game content from VRAM to system memory

    I think that this technology functions at a system level, it would not be something an application (game) would do. For example a browser might be using VRAM and it is considered to be a background process. The browser content might be moved to VRAM, not the foreground game.
    Reply
  • Bonaducci
    Math Geek said:

    wonder how it works with dual screens. does the game still get first dibs on screen 1 and the youtube/discord/browser/monitoring software/etc get neglected on the second screen?

    just curious
    Windows recognizes what is in focus, so it can let drivers prioritize what is actively used vs what is visible but not in focus. Same with games, they can reduce frame rate when not in focus.
    Reply
  • heffeque
    but keep in mind they'll only work on AMD GPUs because Nvidia drivers have closed-source memory management.
    Welp... Linus already voiced his opinion about nVidia years ago, so I'm not surprised nVidia is still subpar on Linux today.
    Reply
  • ejolson
    Linux is by design a multiuser multitasking system. As a result, the default scheduling and memory management algorithms prioritize fairness and throughput. Therefore, I am not shocked that there are optimisations for running a single video game faster.

    It will be interesting if the GPU driver patches are generally useful and robust enough to be included in the mainline Linux kernel. If so, some users might use the same framework to deprioritize all graphical applications to run AI workloads faster.

    On the other hand, if prioritising one application decreases total GPU throughout too much, impressions of general system responsiveness will suffer and one might as well run Microsoft Windows.

    What I find nice about open source is Valve can innovate what they need as needed.
    Reply
  • TerryLaze
    ejolson said:
    Linux is by design a multiuser multitasking system. As a result, the default scheduling and memory management algorithms prioritize fairness and throughput. Therefore, I am not shocked that there are optimisations for running a single video game faster.
    I don't even know for how many years we had this already on windows....
    You can freely choose between prioritizing foreground apps or having it run more like a server.
    Personally I am shocked if linux didn't have this until now, although vram priority is a different matter than this.
    https://www.isunshare.com/images/article/windows-10/2-ways-to-set-cpu-priority-to-prefer-foreground-apps/adjust-best-performance-for-programs.png
    Reply