GPU indirect buffer
1. GPU Resource ManagementGPU channel是GPU与CPU之间的桥接接口,通过CPU向GPU发送GPU指令的唯一通道,GPU channel包含了两类用于存储GPU指令的buffer:GPU command buffer (也称之为FIFO push buffer)Ring buffer (也称之为indirect buffer),从上图中看出,这个buffer是环
1. GPU Resource Management
GPU channel是GPU与CPU之间的桥接接口,通过CPU向GPU发送GPU指令的唯一通道,GPU channel包含了两类用于存储GPU指令的buffer:
- GPU command buffer (也称之为FIFO push buffer)
- Ring buffer (也称之为indirect buffer),从上图中看出,这个buffer是环形结构的,即其容量是固定的,这也是为什么叫Ring buffer的原因吧
当GPU指令被写入到GPU command buffer时,系统还会向Ring buffer中写入与此指令所对应的packet,packet包含了此指令在GPU command buffer中的偏移位置与长度数据。
在执行指令的时候,GPU不是直接从GPU command buffer中读取数据,而是先经过Ring buffer读取出当前待处理指令的相关信息,再据此读取GPU command(这也是为什么Ring buffer被称之为indirect buffer的原因)。
2. Indirect Buffer的作用
Eliminate Unnecessary Data Transfers and Reduce Processor Idle Time
Without an indirect buffer, the GPU generates and writes the call arguments to a regular buffer. The CPU must wait until the GPU completes all of its work before it can read the arguments from the regular buffer and issue the call. The GPU must then wait until the CPU completes all of its work before it can execute the call. This inefficient sequence is shown in Figure 12-1.
Figure 12-1Issuing a call without an indirect buffer
With an indirect buffer, the CPU doesn’t need to wait for any values and can immediately issue a draw call that references an indirect buffer. After the CPU completes all of its work, the GPU can then generate the arguments, write them to the indirect buffer in one pass, and execute the call associated with them in another pass. This improved sequence is shown in Figure 12-2.
Figure 12-2Issuing a call with an indirect buffer
An indirect buffer eliminates unnecessary data transfers between the CPU and the GPU, which results in reduced processor idle time. Use an indirect buffer if the CPU doesn’t need to access the dynamic arguments of a draw or dispatch call.
更多推荐
所有评论(0)