TL;DR
Dr. Top-k introduces a novel "delegate-centric" approach to accelerate top-$k$ computations on GPUs by filtering out over 99% of unnecessary workloads. By partitioning data into subranges and using local maximums as "delegates," it drastically shrinks the data fed into traditional top-$k$ algorithms. This method acts as a universal accelerator for existing algorithms, achieving up to an order-of-magnitude speedup over state-of-the-art GPU implementations across both synthetic and real-world datasets.
What Problem Does This Paper Address?
Finding the top $k$ elements in a massive dataset is a foundational operation for applications ranging from $k$-Nearest Neighbors (KNN) and search engines to deep learning and data mining. On traditional CPUs, the most efficient way to solve this is using a priority queue (like a min-heap). However, GPUs struggle with priority queues because maintaining and merging thousands of local queues across parallel threads requires massive global synchronization, which kills performance.
To get around this, existing GPU algorithms use "sort-and-choose" methods or iterative filtering (like radix, bucket, or bitonic top-$k$). Unfortunately, these methods still do way more work than necessary—sorting or scanning millions of elements that have absolutely no chance of making it into the top $k$. Furthermore, their performance is highly unstable and fluctuates wildly depending on the underlying data distribution.
Methods
The authors propose Dr. Top-k, a "delegate-centric" system that acts as a highly efficient pre-filter for existing top-$k$ algorithms. The core pipeline works as follows:
- Partition & Delegate: The massive input vector is divided into smaller subranges. The algorithm extracts a "delegate" (the maximum element) from each subrange.
- First Top-$k$: A standard top-$k$ algorithm is run only on the tiny vector of delegates.
- Concatenation & Filtering: If a subrange's delegate doesn't make the top $k$, the entire subrange is instantly discarded. For the surviving subranges, elements are further filtered against the minimum value of the delegate top-$k$.
- Second Top-$k$: The final top-$k$ algorithm is run on the concatenated, heavily filtered remnants.
To optimize this, the authors introduce $\beta$ Delegates, where the top $\beta$ elements (e.g., top 2 or 3) are extracted from each subrange instead of just the maximum. This costs slightly more upfront but drastically reduces the final concatenation workload. They also implement GPU-specific optimizations, such as warp-centric memory loading and flag-based in-place radix sorting, to maximize memory throughput. Finally, they scale the system across multiple GPUs using MPI.
Datasets
The authors evaluated Dr. Top-k on both synthetic and real-world datasets:
- Synthetic: Uniform Distribution (UD), Normal Distribution (ND), and Customized Distribution (CD) designed to stress-test bucket top-$k$ algorithms.
- Real-world:
- ANN_SIFT1B: 1 billion 128-dimensional vectors for $k$-Nearest Neighbor search.
- ClueWeb09: A massive webpage graph (1 billion size subset) to calculate website degree centrality.
- TwitterCOVID-19: 1 billion duplicated tweets scored for COVID-19 related fear sentiment.
Key Insights and Ideas
- A Universal Wrapper, Not a Replacement: Dr. Top-k doesn't replace existing top-$k$ algorithms (radix, bucket, bitonic); it acts as a massive data reducer that makes all of them faster.
- Math-Backed Tuning: The authors proved mathematically that the total time consumption of Dr. Top-k is a convex function of the subrange size. This means the "sweet spot" for how large to make the data partitions can be calculated analytically based on hardware latency, rather than relying on trial-and-error heuristics.
- Stable Workload Reduction: Unlike previous bucket or radix methods that choke on skewed data distributions, Dr. Top-k's delegate filtering provides stable, predictable workload reduction regardless of how the data is distributed.
Key Results
- Massive Workload Reduction: The delegate-centric approach successfully filters out over 99% of the input data before the final top-$k$ computation even begins.
- Synthetic Speedups: Compared to state-of-the-art standalone algorithms, Dr. Top-k accelerated radix top-$k$ by up to 10.1x, bucket top-$k$ by up to 118.6x, and bitonic top-$k$ by an astonishing 473x.
- Real-world Speedups: On the massive ClueWeb09 graph dataset, Dr. Top-k assisted algorithms were between 4.6x and 173.7x faster than their baseline counterparts.
- Scalability: The system scales exceptionally well. On datasets exceeding 2 billion elements, Dr. Top-k achieved superlinear speedups when distributed across up to 16 NVIDIA V100 GPUs.
Limitations and Future Work
The authors note a limitation regarding multi-GPU synchronization: they originally attempted to synchronize the $k$-th element across all GPUs via MPI to filter out even more data globally. However, the synchronization overhead outweighed the benefits, so they disabled this feature in the final build.
For future work, while the system scales beautifully up to 16 GPUs, the authors anticipate that moving to massive, multi-node exascale supercomputers will require a hierarchical reduction scheduling method to manage inter-node communication efficiently.
Summary updated