设备软件

共享内存Shared Memory

共享内存是与 CUDA 线程组层次结构(左图)中的线程块级别(左图、中图)相关联的抽象内存。改编自 NVIDIA 的 CUDA 复习:CUDA 编程模型 和 NVIDIA CUDA C++ 编程指南 中的图表。

共享内存 (Shared Memory) 在 CUDA 编程模型 中对应 内存层次结构 中与 线程层次结构线程块 级别相匹配的内存层级。通常,共享内存的容量远小于 全局内存 ,但在吞吐量和延迟方面快得多。

因此,一个相当典型的 内核 通常如下所示:

共享内存存储在 GPU 的 流式多处理器 (SM)L1 数据缓存 中。

英文原文(Modal GPU Glossary)

level (left, center) of the CUDA thread group hierarchy (left). Modified from diagrams in NVIDIA's CUDA Refresher: The CUDA Programming Model and the NVIDIA CUDA C++ Programming Guide.](themed-image://cuda-programming-model.svg)

Shared memory is the level of the memory hierarchy corresponding to the thread block level of the thread hierarchy in the CUDA programming model. It is generally expected to be much smaller but much faster (in throughput and latency) than the global memory.

A fairly typical kernel therefore looks something like this:

Shared memory is stored in the L1 data cache of the GPU's Streaming Multiprocessor (SM).

相关词条

本词条改编自 Modal GPU Glossary(CC BY 4.0)· 中文翻译 miter6/gpu-glossary-zh,MAE 整理排版。