1

这是来自 NVIDIA Compute Visual Profiler 的内核占用分析的副本:

Kernel details : Grid size: 300 x 1, Block size: 224 x 1 x 1
Register Ratio      = 0.75  ( 24576 / 32768 ) [48 registers per thread] 
Shared Memory Ratio = 0 ( 0 / 49152 ) [0 bytes per Block] 
Active Blocks per SM    = 2 : 8
Active threads per SM   = 448 : 1536
Occupancy       = 0.291667  ( 14 / 48 )
Achieved occupancy  = 0.291667  (on 14 SMs)
Occupancy limiting factor   = Registers 
Warning: Grid Size (300) is not a multiple of available SMs (14).

我是 openCL 的新手,我做了很多优化以减少使用的寄存器数量,以便可以在 SM 上启动 3 个并发块。然而,分析器只显示只有 2 个块可以同时运行,并且限制因素是寄存器。但问题是很明显,我的内核每个块只使用 224 x 48 = 10752 个寄存器,因此能够运行 3 个块(即 224 x48 x 3 = 32256 个寄存器 / 32768 个可用寄存器)。当我将每个块的线程数减少到 208 时,问题仍然存在,这意味着它应该只对 3 个块使用 208 x 48 x 3 = 29952 / 32768...

一开始我认为是本地内存的原因,但是我对本地内存的计算表明它应该能够启动3块/ SM。而且我不知道为什么探查器没有显示共享内存比率,尽管我的内核使用本地内存。

谢谢你的帮助。

4

0 回答 0