This paper presents the issues arising in implementing a fast integer division algorithm on general purpose GPUs. The algorithm uses a Newton iteration based on the shifted inverse operation, keeping all arithmetic in the integer domain and relying on data-parallel operators. The principal contribution is an efficient GPU/CUDA implementation for integer precisions from $2^{15}$ to $2^{18}$ -- sizes not supported by \cgbn{} division. We propose algorithmic refinements, define a cost model in terms of multiplications, build on prefix sums and previous work on multi-precision multiplication, and present an evaluation showing near-optimal performance relative to the model for the target precision.
翻译:本文探讨了在通用GPU上实现快速整数除法算法时所面临的问题。该算法采用基于移位逆运算的牛顿迭代法,所有算术运算均在整数域内进行,并依赖数据并行算子。主要贡献在于针对$2^{15}$至$2^{18}$精度的整数——即\cgbn{}除法未支持的位数范围——提出了一种高效的GPU/CUDA实现方案。我们提出了算法优化策略,建立了以乘法运算次数为单位的成本模型,基于前缀和与多精度乘法前期研究成果进行开发,并通过评估表明该方法在目标精度下实现了接近模型理论最优的性能表现。