Skip to main content
QUICK REVIEW

[Paper Review] Faster Radix Sort via Virtual Memory and Write-Combining

Jan Wassenberg, Peter Sanders|arXiv (Cornell University)|Aug 17, 2010
Parallel Computing and Optimization TechniquesComputer Science9 references2 citations
TL;DR

This paper presents a high-performance radix sort algorithm for 32-bit integer keys that leverages virtual memory and software write-combining to achieve near-peak memory bandwidth utilization. By using virtual memory to map output arrays and combining non-temporal writes via software-managed buffers, the algorithm attains 621 M/s throughput on 32-bit keys, outperforming Intel's optimized radix sort by 1.5× and a Fermi GPU (including PCIe overhead) by 1.24×.

ABSTRACT

Sorting algorithms are the deciding factor for the performance of common operations such as removal of duplicates or database sort-merge joins. This work focuses on 32-bit integer keys, optionally paired with a 32-bit value. We present a fast radix sorting algorithm that builds upon a microarchitecture-aware variant of counting sort. Taking advantage of virtual memory and making use of write-combining yields a per-pass throughput corresponding to at least 88 % of the system's peak memory bandwidth. Our implementation outperforms Intel's recently published radix sort by a factor of 1.5. It also compares favorably to the reported performance of an algorithm for Fermi GPUs when data-transfer overhead is included. These results indicate that scalar, bandwidth-sensitive sorting algorithms remain competitive on current architectures. Various other memory-intensive applications can benefit from the techniques described herein.

Motivation & Objective

  • To improve the performance of bandwidth-bound sorting algorithms on modern x86 architectures.
  • To address the performance bottleneck caused by limited write-combine buffers and cache pollution in memory-intensive sorting.
  • To demonstrate that scalar, bandwidth-optimized algorithms remain competitive against highly parallel GPU implementations.
  • To show that virtual memory and software write-combining can be used to achieve near-peak memory throughput in sorting kernels.

Proposed method

  • Uses virtual memory to reserve large, contiguous address spaces for output arrays, avoiding cache pollution.
  • Employs software write-combining by buffering writes in L1 cache lines before issuing non-temporal stores.
  • Applies non-temporal streaming stores to combine multiple writes into single burst transfers, minimizing bus overhead.
  • Optimizes counting sort by replacing histogram counting with direct indexing into pre-allocated per-key buffers.
  • Uses SSE2 intrinsics for efficient vectorized load and non-temporal store operations.
  • Measures memory bandwidth utilization via kernel-mode access to Intel i7 uncore performance counters.

Experimental results

Research questions

  • RQ1Can virtual memory and software write-combining significantly improve the throughput of scalar radix sort on modern x86 systems?
  • RQ2To what extent can software write-combining mitigate the limitations of hardware write-combine buffers?
  • RQ3How does the performance of a highly optimized scalar radix sort compare to a Fermi GPU when including PCIe data transfer overhead?
  • RQ4What fraction of peak memory bandwidth can be achieved by a bandwidth-bound sorting kernel using these techniques?
  • RQ5Why does the measured read traffic exceed write traffic by ~10%, and what causes this imbalance?

Key findings

  • The proposed algorithm achieves a throughput of 621 M/s for 32-bit integer keys, a 1.5× improvement over Intel’s reported performance (adjusted for dual CPU and no hyperthreading).
  • With 32-bit values, the throughput reaches 430 M/s, indicating that computation is a partial bottleneck, though memory bandwidth remains dominant.
  • The algorithm achieves 88% of the theoretical peak memory bandwidth, with 2041 MiB written and 2272 MiB read over four passes.
  • The additional 10% read traffic beyond writes is unexplained and warrants further investigation.
  • Despite lower transistor count (1.46B vs. 3B) and thermal design power (260W vs. 300W), the dual-CPU implementation outperforms a GTX 480 GPU when PCIe data transfer overhead is included.
  • The measured bandwidth utilization suggests minimal room for further optimization, as the time spent on memory operations is already close to the theoretical minimum.

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.