TL;DR

Researchers have developed a method to use Nvidia GPU VRAM as swap space on Linux systems. This approach utilizes the CUDA driver API and NBD protocol, providing a high-priority, high-speed swap alternative for hybrid laptops with soldered memory. Performance benchmarks show it can significantly expand effective memory, though with some limitations compared to traditional SSD swap.

Linux users with Nvidia GPUs can now use their GPU’s VRAM as swap space thanks to a new open-source daemon that leverages the CUDA driver API and the NBD protocol. This development addresses hardware limitations in hybrid laptops with soldered memory, offering a high-priority, high-speed swap alternative that can significantly expand available memory.

The method involves a small daemon that allocates VRAM via the CUDA API and exposes it as a block device through the NBD protocol. This device is then used as swap space, bypassing traditional kernel limitations and driver restrictions that prevent direct VRAM pinning on consumer GPUs.

Tested on an AMD/ATI + Nvidia RTX 3070 laptop running Pop!_OS with kernel 6.17 and driver 580.159.03, the setup allocated 7 GB of VRAM as swap, increasing total addressable memory to approximately 46 GB when combined with zram and SSD swap. Benchmarks show that VRAM swap has lower latency than NVMe for sporadic access but is slower for large sequential transfers due to overhead from socket and CUDA calls.

Why It Matters

This development could improve performance and usability for users with hybrid laptops or systems with soldered memory, as it allows more efficient use of existing hardware resources. It also offers a workaround for driver and hardware limitations that restrict direct VRAM access, potentially enabling higher memory capacities without hardware upgrades.

However, the approach is not suitable for high-throughput, sustained swap workloads, where NVMe remains faster. Its primary benefit lies in reducing memory pressure and improving responsiveness during sporadic memory demands.

Amazon

Nvidia GPU VRAM as swap space Linux

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Background

Hybrid laptops with soldered RAM often face limitations in expanding memory, and existing solutions like zram or SSD swap have performance trade-offs. Previous attempts to directly pin VRAM for swap via the NVIDIA P2P API failed due to driver restrictions, especially on consumer GPUs. This new method circumvents these issues by using CUDA’s memcpy functions and the NBD protocol, which do not require kernel modules or special permissions.

The approach has been tested on specific hardware configurations, with benchmarks indicating its advantages and limitations. It builds on ongoing efforts to optimize resource utilization in Linux systems with hybrid graphics setups.

“This method allows Linux users to effectively turn unused Nvidia VRAM into high-priority swap, expanding memory capacity without hardware upgrades.”

— Author of the project

“While VRAM swap offers lower latency for sporadic access, it is slower for sustained large transfers compared to NVMe SSDs, due to the overhead involved.”

— Hardware performance analyst

Amazon

CUDA API compatible SSD for swap

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It is not yet clear how well this approach scales across different Nvidia GPU models or Linux distributions. Compatibility with future driver updates and kernel versions remains uncertain, as does long-term stability under various workloads.

Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive - Includes Boot Repair and Install Guide Now with USB Type C

Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive – Includes Boot Repair and Install Guide Now with USB Type C

Linux Mint 22 on a Bootable 8 GB USB type C OTG phone compatible storage

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

Further testing across a wider range of hardware and Linux environments is expected. Developers may refine the daemon, improve performance, and explore integration into mainstream Linux distributions. User feedback and real-world usage will determine its broader adoption.

Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive - Includes Boot Repair and Install Guide Now with USB Type C

Learn How to Use Linux, Linux Mint Cinnamon 22 Bootable 8GB USB Flash Drive – Includes Boot Repair and Install Guide Now with USB Type C

Linux Mint 22 on a Bootable 8 GB USB type C OTG phone compatible storage

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

Can I use this method on any Nvidia GPU?

It works on consumer CUDA-enabled Nvidia GPUs, including RTX and GTX series, but performance and compatibility may vary depending on the specific model and driver version.

Does this approach impact system stability?

Since it uses standard CUDA API functions and a user-space daemon, it is designed to be stable, but as with any experimental feature, users should test thoroughly before relying on it for critical workloads.

Will this replace traditional swap devices?

No, VRAM-based swap is intended as a supplementary high-priority memory pool for sporadic use, not a full replacement for SSD or HDD swap devices, especially for sustained high-throughput workloads.

How easy is it to set up?

The setup involves installing the daemon, configuring systemd services, and allocating VRAM as swap, which requires some command-line familiarity but is documented in the project’s README.

Source: Hacker News

You May Also Like

Can Smart Recovery Tools Improve Workout Consistency?

Of course, smart recovery tools could be the key to enhancing your workout consistency—discover how they can transform your routine today.

How to Make Recovery a Real Part of Your Weekly Training Plan

Never underestimate the power of strategic recovery; discover essential tips to truly integrate rest into your weekly training plan for optimal results.

Can Connected Recovery Tools Support Better Sleep Habits?

Connected recovery tools can profoundly support better sleep habits by syncing with…

Can Recovery Devices Help You Feel Better Between Workouts?

A look into recovery devices reveals how they can improve your post-workout feeling, but the key benefits may surprise you.