High-Performance GPU Memory Transfer Optimization for Large Language Models

perplexity · Tech · year n/a · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: LLM infrastructure GPU networking

Perplexity needed to transfer non-contiguous GPU memory regions between machines at near-maximum AWS p5 network bandwidth while supporting asynchronous workloads and dynamic Kubernetes node changes.

Constraints:

Architecture

Perplexity built a custom high-performance networking solution on AWS p5 instances using Elastic Fabric Adapter, RDMA, GPUDirect, and libfabric. Control messages use two-sided RDMA SEND/RECV to exchange memory-region metadata such as offsets and sizes, while the actual data plane uses one-sided RDMA WRITE operations where each write handles one contiguous GPU memory chunk. The implementation evolved from unidirectional SEND/RECV to bidirectional communication, direct GPU-to-GPU GPUDirect RDMA writes, multiple concurrent transfers, application-level operation queuing, and finally 32-network-card scaling with warmup, per-GPU network threads, CPU core pinning, state sharding, batching, lazy operation posting, and NUMA-aware libfabric resource allocation.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Kubernetes deployment"] --> B["Transfer application"]
  B --> C["Application operation queue"]
  C --> D["Completion polling loop"]
  D --> E["libfabric layer"]
  B --> E
  E --> F["RDMA control plane"]
  F --> G["Memory registration"]
  E --> H["RDMA data plane"]
  G --> I["Source H100 GPU"]
  H --> J["EFA network cards"]
  I --> J
  J --> K["Destination H100 GPU"]
  B --> L["Topology-aware threading"]
  L --> J
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Kubernetes deployment Dynamic deployment environment where nodes must be added or removed without disrupting ongoing operations. Transfer application
Transfer application Custom networking application that owns buffers, queues operations, polls completions, and coordinates GPU-to-GPU memory transfer. Application operation queue, libfabric layer, Completion polling loop
Application operation queue Application-level pending-operation queue that improves robustness against congestion and simplifies submission. Completion polling loop, libfabric layer
Completion polling loop User-space polling of hardware completion queues to avoid system-call notification overhead and trigger lazy posting. Application operation queue, libfabric layer
libfabric layer Fabric-services interface used to implement SEND/RECV control messages and one-sided RDMA WRITEs. RDMA control plane, RDMA data plane
RDMA control plane Kernel-mediated connection setup, memory registration, and metadata exchange for memory regions. Memory registration, RDMA data plane
Memory registration One-time virtual-address setup so CPU, GPUs, and network cards can perform zero-copy transfers safely. Source H100 GPU, EFA network cards
RDMA data plane Kernel-bypassing one-sided RDMA WRITE path for actual GPU memory transfer. EFA network cards
EFA network cards AWS Elastic Fabric Adapter network interfaces implementing SRD and RDMA transport across 32 cards on p5 instances. Source H100 GPU, Destination H100 GPU
Source H100 GPU GPU whose registered memory is read directly by the local network card. EFA network cards
Destination H100 GPU Remote GPU whose memory is written directly by the receiving network card. EFA network cards
Topology-aware threading Per-GPU network threads, CPU core pinning, state sharding, and NUMA-aware resource allocation to avoid cross-socket penalties. Transfer application, EFA network cards

Data flow

The application registers GPU memory so CPU, GPUs, and network cards share the same virtual address understanding. Control-plane operations such as connection setup, memory registration, and SEND/RECV metadata messages go through the kernel where required for security. Data-plane transfer bypasses the kernel: a network card reads directly from source GPU memory, sends the bytes over EFA/SRD to the remote network card, and the remote card writes directly into destination GPU memory. The application maintains queues of pending operations, polls hardware completion queues, batches and lazily posts work to network cards, and pins network threads and libfabric resources to the correct NUMA locality.

3 supporting quotes
“Two-sided RDMA (SEND/RECV) for control messages that carry metadata about memory regions (e.g., offsets and sizes).”article, stated
“One-sided RDMA WRITE for actual data transfer, where each WRITE operation handles one contiguous memory chunk.”article, stated
“Data travels directly to the remote network card”article, stated

Why this architecture

Perplexity chose a custom RDMA/libfabric implementation because its workload needed asynchronous peer-to-peer transfers, dynamic Kubernetes membership, and direct control over non-contiguous GPU memory movement. Traditional TCP/IP copies data through CPU and kernel buffers, while RDMA/EFA/GPUDirect lets network cards move data directly between GPU memories. NCCL is strong for collective communication, but its static world and synchronous model did not fit this dynamic asynchronous transfer problem.

3 supporting quotes
“NCCL excels at collective communication but requires establishing a static "world", which requires restarting the entire cluster when adjusting the participating nodes.”article, stated
“NCCL's synchronous communication model adds complexity for our asynchronous workload”article, stated
“EFA with RDMA allows direct data transfer between GPU memory and the network card, bypassing the CPU entirely.”article, stated

Models used: large language models · deep learning workloads

Scale

Alternatives considered (roads not taken)

Use NVIDIA NCCL

Rejected because: NCCL is excellent for collective distributed deep-learning communication, but its static world and synchronous model conflicted with Perplexity's dynamic, asynchronous workload.

“While NVIDIA's NCCL library is the de facto standard for distributed deep learning, it wasn't ideal for our use case”article, stated
“NCCL's synchronous communication model adds complexity for our asynchronous workload”article, stated

Use traditional TCP/IP networking

Rejected because: TCP/IP requires multiple copies through user space, kernel space, and network buffers, consuming CPU cycles and memory bandwidth.

“With TCP/IP (left side), data must be copied multiple times”article, stated
“Each copy operation consumes CPU cycles and memory bandwidth.”article, stated

Let the kernel own network buffers and completion notifications

Rejected because: Kernel-managed buffers and epoll-style notifications add copies and system-call overhead that high-performance RDMA avoids.

“Unlike traditional sockets where the kernel manages network buffers and requires copying between user space and kernel space”article, stated
“Instead of waiting for kernel notifications through mechanisms like epoll, applications directly poll hardware completion queues.”article, stated

Submit operations directly to network cards

Rejected because: Direct submission is less robust under congestion; an application-level queue simplifies the programming model and lets pending work be posted lazily after completions.

“Rather than directly submitting operations to network cards, we maintain an application-level queue.”article, stated
“Operations are first queued in the application. After polling the completion queue, we attempt to submit pending operations to the network card”article, stated

Patterns

latency-optimization (infrastructure)

Perplexity eliminated CPU/kernel data copies with RDMA, used GPUDirect GPU-to-GPU writes, polled completion queues in user space, pinned threads, and made resource allocation NUMA-aware.

“The network card reads directly from GPU memory”article, stated
“CPU Core Pinning: Binding threads to specific CPU cores to avoid NUMA effects and cache misses.”article, stated

fallback-degradation (robustness)

Application-level operation queuing and lazy posting provide robustness against congestion while maintaining efficient network-card utilization.

“Operation Queuing: Rather than directly submitting operations to network cards, we maintain an application-level queue.”article, stated
“This provides robustness against network congestion and simplifies the programming model.”article, stated

cost-aware-routing (resource utilization)

The system explicitly targets near-theoretical utilization of the expensive p5/EFA/H100 network topology by spreading work across all 32 network cards and minimizing wasted CPU/memory copies.

“When scaling to 32 network cards, we implemented several crucial optimizations”article, stated
“demonstrating near-theoretical bandwidth utilization of the network infrastructure”article, stated

Tradeoffs

Build a custom solution instead of using NCCL

Chose custom libfabric/EFA/RDMA transfer layer over NVIDIA NCCL collective communication.

Rationale: Perplexity wanted asynchronous peer-to-peer transfer, dynamic Kubernetes membership, and direct control over memory-transfer patterns, which NCCL's static world and synchronous model did not fit.

“We wanted direct control over our memory transfer patterns for optimization”article, stated
“Building our own solution provided valuable learning opportunities”article, stated

Use RDMA/EFA rather than TCP/IP

Chose direct GPU-memory-to-network-card transfer over kernel-mediated TCP/IP socket copies.

Rationale: TCP/IP incurs repeated copies and context switches, while RDMA moves data directly between GPU memory and network cards.

“Unlike traditional TCP/IP networking where data must be copied multiple times between user space, kernel space, and network buffers”article, stated
“In contrast, RDMA (right side) provides true zero-copy data transfer: 1. The network card reads directly from GPU memory”article, stated

Separate control plane from data plane

Chose kernel-mediated setup and metadata, kernel-bypassing data transfer over sending all operations through the same socket-style path.

Rationale: Security-sensitive setup still goes through the kernel, while the high-volume data path bypasses it for maximum performance.

“Control plane operations (like connection setup and memory registration) go through the kernel to ensure security”article, stated
“Data plane operations (actual data transfer) bypass the kernel for maximum performance”article, stated

Queue and lazily post operations

Chose application-level queue with completion-driven submission over immediate direct submission to network cards.

Rationale: Queuing improves robustness against congestion and lets the application submit pending operations when the completion queue indicates capacity is available.

“Rather than directly submitting operations to network cards, we maintain an application-level queue.”article, stated
“After polling the completion queue, we attempt to submit pending operations to the network card”article, stated

Gotchas (what bit them)

NCCL's static world conflicts with dynamic Kubernetes membership.

Root cause: NCCL requires a fixed participating set for collective communication, so changing nodes requires restarting the whole cluster.

Resolution: Perplexity built a custom libfabric/RDMA transfer layer that supports dynamic add/remove behavior and peer-to-peer transfer patterns.

“NCCL excels at collective communication but requires establishing a static "world", which requires restarting the entire cluster when adjusting the participating nodes.”article, stated
“Ability to dynamically add or remove nodes from Kubernetes deployments without disrupting ongoing operations”article, stated

Zero-copy networking shifts buffer responsibility to the application.

Root cause: RDMA bypasses kernel-managed sockets, so the application must manage buffer ownership, memory registration, receive posting, and completion polling.

Resolution: The implementation registers memory, pre-posts receives, transfers ownership to network cards during operations, and polls completion queues directly.

“RDMA requires applications to manage their own buffers.”article, stated
“Without kernel-managed buffers, applications must pre-post receive operations, specifying where incoming data should be placed.”article, stated

Hardware topology can dominate achievable bandwidth.

Root cause: p5 topology has NUMA sockets, PCIe switches, EFAs, GPUs, and NVMe devices whose pairing affects whether transfers stay local or congest shared buses.

Resolution: Use proper hardware pairing, per-GPU threads, CPU core pinning, state sharding, and NUMA-aware libfabric resource allocation.

“Hardware Topology Awareness: Understanding and optimizing for hardware topology is crucial for achieving maximum performance.”article, stated
“NUMA-aware Resource Allocation: Allocate libfabric resources like completion queues on the correct NUMA node to minimize memory access latency.”article, stated

Non-contiguous memory complicates direct RDMA transfer.

Root cause: One RDMA WRITE handles one contiguous memory chunk, while the workload needs to transfer non-contiguous GPU memory regions.

Resolution: The custom solution sends control metadata about offsets and sizes and decomposes transfers into RDMA WRITE operations for contiguous chunks.

“High-bandwidth transfer between remote GPUs of non-contiguous memory chunks”article, stated
“each WRITE operation handles one contiguous memory chunk.”article, stated

Evaluation

Perplexity evaluated the custom RDMA implementation through progressive performance milestones: basic SEND/RECV, bidirectional communication, GPUDirect RDMA WRITE, concurrent transfers, operation queuing, single-card utilization, and full 32-card scaling. Final results were reported as Gbps and percentage of theoretical bandwidth, including a command-line demo.

Metrics: 97.4% bandwidth utilization on a single network card · 3,108 Gbps final performance · 97.1% of theoretical maximum bandwidth · 3108.283 Gbps command-line demo transmission speed · 32 network cards used for scaling

3 supporting quotes
“Achieved 97.4% bandwidth utilization on a single network card”article, stated
“Through these optimizations, we achieved a final performance of 3,108 Gbps - 97.1% of the theoretical maximum bandwidth.”article, stated
“It transfers non-contiguous chunks of GPU memory to a remote node, achieving a transmission speed of 3108.283 Gbps”article, stated

Outcomes

The solution targets AWS p5 infrastructure with 32 EFA network cards and 3200 Gbps theoretical bandwidth, optimizing peer-to-peer transfer of non-contiguous GPU memory for large-scale deep-learning and LLM workloads.

3 supporting quotes
“achieves 97.1% of this theoretical bandwidth.”article, stated
“The full technical deep-dive of this journey, including implementation details and code examples, is available in our open source repository.”article, stated
“Our journey demonstrates that achieving near-theoretical network performance is possible with careful attention to system architecture”article, stated