Abstract
An obvious way to alleviate memory difficulties in GPU-based AI computing is via CPU offload, where data are moved between GPU and CPU RAM, so inexpensive CPU RAM is used to increase the amount of storage available. While CPU offload is an obvious idea, it can greatly slow down a computation, due to the relatively slow transfer rate between CPU RAM and GPU RAM. Thus, any system for CPU offload needs to ensure that when such a transfer needs to happen, no computation is blocked waiting for the transfer to finish. One of the key challenges when using CPU offload is that memory transfers introduce nondeterminacy into the system: it is not possible to know before runtime when the transfers will finish, and hence what is the best order of operations to run to ensure there is no blocking. In this paper, we describe TURNIP, which is a system for running AI computations using CPU offload. The key innovation in TURNIP is the compilation of the AI computation into a dependency graph that gives the TURNIP runtime freedom to run operations such as GPU kernel calls in many different orders; at runtime, TURNIP chooses the best order in response to real-time events.
Introduction: Breaking the GPU Memory Wall
Modern Large Language Models (LLMs) have pushed GPU memory requirements to their limits. Processing long sequences, such as a 100,000-token prompt in LLaMA, can require upwards of 2.4 terabytes of memory for intermediate activations—far exceeding the capacity of even the most advanced 80GB H100 GPUs.
The standard mitigation strategy is CPU offload, which leverages the significantly larger and cheaper CPU RAM. However, the PCIe bus connecting GPU and CPU memory is a notorious bottleneck. To maintain high throughput, systems must "overlap" computation with data transfers. Traditional runtimes often fail here because they rely on rigid, deterministic execution schedules. If a data transfer lags due to system noise or bus contention, the entire pipeline stalls. TURNIP addresses this by embracing "nondeterminism"—allowing the runtime to adapt its execution order dynamically based on real-time hardware events.
The TURNIP Architecture: MEMGRAPH and Nondeterministic Execution
TURNIP (nondeTerministic gpU RuNtime wIth cPu offload) moves away from simple dataflow graphs toward a more constrained yet flexible structure called the MEMGRAPH.
1. The MEMGRAPH
The MEMGRAPH is a dependency graph that explicitly incorporates memory constraints. Unlike standard graphs that only track data dependencies (e.g., "Task B needs the output of Task A"), the MEMGRAPH adds memory dependencies. These ensure that a memory slot on the GPU is not overwritten until its current contents have been safely consumed or offloaded to CPU RAM.
By mapping every tensor to a specific memory location, TURNIP can aggressively reuse memory without risking race conditions. This spatial mapping allows the compiler to reason about memory pressure before execution begins.
2. Nondeterministic Runtime
The core of TURNIP is its event-driven runtime. Instead of following a pre-baked instruction list, the runtime monitors the GPU for completion signals (e.g., a kernel finishing or a DMA transfer completing). As soon as an event occurs, the runtime scans the MEMGRAPH for any task whose dependencies—both data and memory—are now satisfied. This allows the system to bypass stalled transfers and keep the GPU cores busy with other ready tasks, effectively hiding the latency of the PCIe bus.
Evaluation and Results
The researchers evaluated TURNIP using Meta’s LLaMA models (7B and 65B) across two primary workloads: first-token (prefill) inference and LoRA (Low-Rank Adaptation) training. Tests were performed on modern AWS A100 instances and older, memory-constrained P100 servers.
Performance and Resilience
TURNIP consistently outperformed established baselines like ZeRO-Inference and FlexGen. In inference tasks, the performance gap widened as sequence lengths increased, demonstrating TURNIP's superior handling of high memory pressure. Notably, in environments where other systems crashed with "Out of Memory" (OOM) errors (such as the P100 setup), TURNIP successfully completed the workloads.
The Value of Nondeterminism
To isolate the impact of its dynamic scheduling, the authors compared TURNIP against a version of itself restricted to a fixed execution order. The results were striking: the nondeterministic scheduler alone provided a speedup of 4% to 6.5% for inference and 13% to 14.5% for training. For LoRA training on A100 GPUs, TURNIP was often twice as fast as ZeRO-Infinity for shorter sequence lengths.
Conclusion and Future Work
TURNIP demonstrates that the "memory wall" can be breached not just through hardware scaling, but through smarter software runtimes. By treating memory as a first-class dependency and allowing for fluid execution orders, TURNIP makes massive AI models accessible on a wider range of hardware.
Current limitations include a reliance on static computation graphs and manual kernel decomposition. Future iterations of TURNIP aim to support dynamic graphs for recursive token generation and to automate the optimization of input dataflows, further pushing the boundaries of GPU memory efficiency.
Summary updated