[论文解读] LightScan: Faster Scan Primitive on CUDA Compatible Manycore Processors
LightScan 是一种针对 CUDA 兼容 GPU 的高性能并行扫描原语,通过使用 warp shuffle 指令加速块内计算,并利用全局一致的 L2 缓存与 PTX 汇编实现轻量级块间通信,显著提升性能。在 Tesla K40c GPU 上,其性能相比领先的 GPU 库最高提升 2.4×,相比 Intel TBB 在 Xeon Phi 上最高提升 257.3×,在多种数据类型和问题规模下均表现出卓越性能。
Scan (or prefix sum) is a fundamental and widely used primitive in parallel computing. In this paper, we present LightScan, a faster parallel scan primitive for CUDA-enabled GPUs, which investigates a hybrid model combining intra-block computation and inter-block communication to perform a scan. Our algorithm employs warp shuffle functions to implement fast intra-block computation and takes advantage of globally coherent L2 cache and the associated parallel thread execution (PTX) assembly instructions to realize lightweight inter-block communication. Performance evaluation using a single Tesla K40c GPU shows that LightScan outperforms existing GPU algorithms and implementations, and yields a speedup of up to 2.1, 2.4, 1.5 and 1.2 over the leading CUDPP, Thrust, ModernGPU and CUB implementations running on the same GPU, respectively. Furthermore, LightScan runs up to 8.9 and 257.3 times faster than Intel TBB running on 16 CPU cores and an Intel Xeon Phi 5110P coprocessor, respectively. Source code of LightScan is available at http://cupbb.sourceforge.net.
研究动机与目标
- 设计一种比现有 GPU 和 CPU 实现更快速的 CUDA 兼容 GPU 并行扫描原语。
- 通过利用全局 L2 缓存一致性和 PTX 指令,减少块间通信开销。
- 通过确定性的循环块分发避免线程块重索引的开销,从而最小化开销。
- 最大化每个流式多处理器的寄存器使用率,以减少块间通信次数。
- 通过 CUDA C++ 模板类实现高效、通用且可重用的扫描计算,支持标量数据类型。
提出的方法
- 采用混合的块内与块间计算模型,将输入数组划分为非重叠的数据块,并分配给线程块。
- 使用 warp shuffle 函数加速每个线程块内的本地扫描计算,减少对全局内存存储中间结果的依赖。
- 通过合并的全局内存访问实现输入和输出数组的访问,确保每个数组恰好进行 N 次内存操作。
- 利用全局一致的 L2 缓存和 PTX 层级的并行线程执行指令,实现轻量级、高带宽的块间通信。
- 以确定性方式将数据块循环分发到固定数量的线程块中,避免线程块重索引过程中原子操作的瓶颈。
- 采用基于模板的 CUDA C++ 设计,支持对 Int32、Int64、Float 和 Double 等原语标量数据类型的通用实例化。
实验结果
研究问题
- RQ1通过优化内存访问和通信模式,混合的块内与块间扫描模型是否能在现代 CUDA GPU 上实现更优性能?
- RQ2与传统的原子或递归块间通信相比,使用 warp shuffle 函数和 L2 缓存一致性对并行扫描性能的影响如何?
- RQ3在计算能力 3.0 或更高的 GPU 架构上,寄存器饱和和确定性块分发在多大程度上可减少块间通信并提升可扩展性?
- RQ4在不同数据类型和问题规模下,LightScan 与高度优化的 GPU 库(如 CUB、Thrust 和 CUDPP)相比性能如何?
- RQ5在 Xeon Phi 等多核加速器上,LightScan 是否能显著超越基于 CPU 的并行库(如 Intel TBB)?
主要发现
- 在 Tesla K40c GPU 上,LightScan 相比 NVIDIA Thrust 最高提升 2.4×,相比 CUDPP 提升 2.1×,相比 ModernGPU 提升 1.5×,相比 CUB 提升 1.2×。
- 在所有测试数据类型下,LightScan 平均性能分别优于 CUDPP、Thrust、ModernGPU 和 CUB 2.0×、2.1×、1.5× 和 1.2×。
- 在 16 个 CPU 核心上运行的 Intel TBB 上,LightScan 平均提升 8.4×,最高提升 8.9×,Int32 类型峰值性能达 3.1 GEPS。
- 在 Intel Xeon Phi 5110P 协处理器上,LightScan 平均性能相比 TBB 提升 80.8×,最高提升 257.3×,凸显其在多核加速器上的卓越优势。
- 在 Tesla K40c 上,LightScan 的峰值性能达到 25.5 GEPS(32 位整数)、12.8 GEPS(64 位整数)、25.7 GEPS(单精度浮点)和 13.0 GEPS(双精度浮点)。
- LightScan 的性能优势在 Xeon Phi 上最为显著,此时 TBB 性能显著下降,表明 GPU 优化算法对多核加速器至关重要。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。