寄存器压力register pressure
寄存器压力是一个形象的术语,用于描述 寄存器文件 成为 性能瓶颈 时的情况。
在 并行线程执行 (PTX) 语言中,寄存器 是虚拟的且数量不受限制,但 流式多处理器 (SM) 的 寄存器文件 是物理存在的,因此存在数量限制。
线程 消耗的 寄存器文件 空间大小由 内核 的 流式汇编器 (SASS) 代码决定。由于 线程块 中的所有 线程 都被调度到同一个 SM 上执行,因此 线程块 所需的总空间也由 内核 启动配置决定。随着每个 线程块 分配的空间增加,能够调度到同一个 SM 上的 线程块 数量就会减少,从而降低 占用率,并使得 延迟隐藏 更加困难。
关于寄存器压力与近年来 流式多处理器架构 新增关键特性(如 Ampere 架构添加的异步拷贝、Hopper 架构添加的 张量内存加速器 (TMA) 以及 Blackwell 架构添加的 张量内存)之间关系的详细说明,请参阅 SemiAnalysis的这篇优秀文章。
寄存器压力也存在于 CPU 中,类似的寄存器 瓶颈 会限制 自动向量化过程中循环的分块优化 程度。
英文原文(Modal GPU Glossary)
Register pressure is a colorful term used when the register file is a bottleneck.
Registers in the Parallel Thread eXecution (PTX) language are virtual and unlimited, but the register files of the Streaming Multiprocessor (SM) are physical and so limited.
The amount of space in the register file consumed by a thread is determined by the Streaming ASSembler (SASS) code for the kernel, and since all threads in a thread block are scheduled onto the same SM, the total space required by a thread block is determined also by the kernel launch configuration. As the space allocated per thread block increases, fewer thread blocks can be scheduled onto the same SM, reducing occupancy and making it more difficult to hide latency.
See this excellent article by SemiAnalysis for an account of the relationship between register pressure and key features added in recent Streaming Multiprocessor architectures, like asynchronous copies (added in Ampere), the Tensor Memory Accelerator (TMA, added in Hopper), and tensor memory (added in Blackwell).
Register pressure also occurs in CPUs, where similar register bottlenecks limit the degree to which loops can be strip-mined during auto-vectorization.
相关词条
本词条改编自 Modal GPU Glossary(CC BY 4.0)· 中文翻译 miter6/gpu-glossary-zh,MAE 整理排版。