Home Knowledge Base DMA Engines and Zero-Copy Transfers

DMA Engines and Zero-Copy Transfers are the hardware components and programming techniques that transfer data between memory regions (CPU↔GPU, GPU↔NVMe, NIC↔GPU) without CPU involvement — freeing the CPU to perform computation while data moves autonomously through dedicated DMA controllers, and in the zero-copy case eliminating data copies entirely by mapping device-accessible memory that both CPU and device can read/write directly.

Why DMA Matters

DMA in GPU Computing

Transfer TypeMechanismBandwidth
Host → Device (H2D)GPU DMA (copy engine)PCIe 5.0: ~64 GB/s
Device → Host (D2H)GPU DMA (copy engine)PCIe 5.0: ~64 GB/s
Device → Device (D2D)P2P DMA or NVLinkNVLink: ~900 GB/s
BidirectionalDual DMA engines2× unidirectional

CUDA Async DMA (cudaMemcpyAsync)

cudaStream_t copy_stream, compute_stream;
cudaStreamCreate(&copy_stream);
cudaStreamCreate(&compute_stream);

// Overlap DMA with computation using separate streams
for (int i = 0; i < N; i++) {
    // DMA: Copy next batch to GPU (runs on copy engine)
    cudaMemcpyAsync(d_input[i%2], h_input[i], size,
                    cudaMemcpyHostToDevice, copy_stream);
    
    // Compute on previously loaded batch (runs on SMs)
    if (i > 0)
        process<<<grid, block, 0, compute_stream>>>(d_input[(i-1)%2], d_output);
    
    // Ensure copy finishes before next compute uses this buffer
    cudaEventRecord(event, copy_stream);
    cudaStreamWaitEvent(compute_stream, event);
}

Pinned (Page-Locked) Memory

Zero-Copy Memory

// Allocate mapped memory (accessible by both CPU and GPU)
float *h_data;
cudaHostAlloc(&h_data, size,
              cudaHostAllocMapped | cudaHostAllocWriteCombined);

// Get device pointer to same physical memory
float *d_data;
cudaHostGetDevicePointer(&d_data, h_data, 0);

// GPU kernel reads/writes host memory directly — no explicit copy
my_kernel<<<grid, block>>>(d_data);  // Accesses over PCIe on demand

GPUDirect Storage (GDS)

 Without GDS: NVMe → kernel buffer → user buffer → GPU (3 copies)
 With GDS:    NVMe → GPU directly (DMA, 1 copy, CPU bypass)

NVIDIA Copy Engines

DMA engines and zero-copy transfers are the data movement infrastructure that enables efficient heterogeneous computing — by decoupling data transfer from computation and eliminating unnecessary copies, DMA-based approaches ensure that the CPU, GPU, NIC, and storage devices can all operate concurrently, maximizing system throughput and keeping expensive accelerators fed with data rather than waiting idle for transfers to complete.

dma enginezero copy transferdirect memory accessgpu dmamemory transfer engine

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.