GPU Programming
Why does pinning (page-locking) CPU memory before transferring it to the GPU speed up the transfer?
- AThe OS will not move or evict those pages, so the GPU can DMA directly without an intermediate copy, and asynchronous transfers become possible
- BPinning compresses the data
- CPinning upgrades the PCI Express generation
Show answer and explanation
Answer: A. The OS will not move or evict those pages, so the GPU can DMA directly without an intermediate copy, and asynchronous transfers become possible
The OS can move ordinary memory to another physical page or evict it to storage at any time, so letting the GPU's DMA access it directly would be unsafe. Normally, therefore, the data is first copied into a temporary pinned buffer before transfer. Using pinned memory from the start removes that extra copy and also allows asynchronous transfers that overlap with CPU work.
- A. Correct. Overusing it can starve the OS of memory, though.
- B. Nothing is compressed.
- C. The generation does not change.