Skip to main content
QUICK REVIEW

[Paper Review] Onesweep: A Faster Least Significant Digit Radix Sort for GPUs

Andy Adinets, Duane Merrill|arXiv (Cornell University)|Jun 3, 2022
Algorithms and Data CompressionComputer Science5 citations
TL;DR

Onesweep introduces a novel least-significant digit (LSD) radix sort for GPUs that reduces global memory traffic by using a single-pass prefix sum technique, requiring only ~2n global memory operations per digit-binning iteration—compared to ~3n in prior methods. On the NVIDIA A100, it achieves 29.4 GKey/s for 256M random 32-bit keys, delivering a 1.5x speedup over CUB and outperforming HRS across diverse key distributions.

ABSTRACT

We present Onesweep, a least-significant digit (LSD) radix sorting algorithm for large GPU sorting problems residing in global memory. Our parallel algorithm employs a method of single-pass prefix sum that only requires ~2n global read/write operations for each digit-binning iteration. This exhibits a significant reduction in last-level memory traffic versus contemporary GPU radix sorting implementations, where each iteration of digit binning requires two passes through the dataset totaling ~3n global memory operations. On the NVIDIA A100 GPU, our approach achieves 29.4 GKey/s when sorting 256M random 32-bit keys. Compared to CUB, the current state-of-the-art GPU LSD radix sort, our approach provides a speedup of ~1.5x. For 32-bit keys with varied distributions, our approach provides more consistent performance compared to HRS, the current state-of-the-art GPU MSD radix sort, and outperforms it in almost all cases.

Motivation & Objective

  • To reduce global memory traffic in GPU-based LSD radix sorting by minimizing redundant memory operations.
  • To design a high-performance, scalable sorting kernel suitable for large-scale datasets in global memory.
  • To outperform existing state-of-the-art GPU radix sort implementations in both speed and consistency across varying key distributions.
  • To enable efficient sorting on GPUs by optimizing memory access patterns during digit-binning phases.

Proposed method

  • The algorithm uses a single-pass prefix sum computation that eliminates the need for two separate memory passes per digit-binning iteration.
  • It leverages a segmented, parallel prefix sum pattern to compute bin offsets efficiently with minimal global memory traffic.
  • The method employs a two-phase kernel launch: first to compute bin counts and then to perform exclusive scan and scatter into output bins using the computed offsets.
  • It uses a warp-level reduction and shuffle-based approach to minimize divergence and maximize occupancy on the GPU.
  • The design minimizes global memory operations to ~2n per digit-binning step, significantly reducing last-level cache pressure.
  • It supports 32-bit keys and is optimized for random and varied key distributions commonly found in real-world workloads.

Experimental results

Research questions

  • RQ1Can a single-pass prefix sum technique reduce global memory operations in GPU LSD radix sort below the current two-pass standard?
  • RQ2How does reducing memory traffic impact performance on modern GPUs like the A100?
  • RQ3Can the proposed method maintain high performance across diverse key distributions, including non-uniform and skewed data?
  • RQ4How does the algorithm compare to CUB and HRS in terms of throughput and consistency?

Key findings

  • Onesweep achieves 29.4 GKey/s when sorting 256M random 32-bit keys on the NVIDIA A100 GPU, significantly outperforming CUB.
  • The algorithm delivers a 1.5x speedup over CUB, the current state-of-the-art GPU LSD radix sort, under identical conditions.
  • Onesweep provides more consistent performance across varied key distributions than HRS, the state-of-the-art GPU MSD radix sort.
  • The method reduces global memory operations per digit-binning iteration to ~2n, compared to ~3n in prior approaches, significantly lowering last-level memory traffic.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.