[论文解读] Faster Radix Sort via Virtual Memory and Write-Combining
本文提出了一种针对32位整数键的高性能基数排序算法,通过利用虚拟内存和软件写合并技术,实现了接近峰值内存带宽的利用率。通过使用虚拟内存映射输出数组,并借助软件管理的缓冲区合并非临时写入,该算法在32位键上实现了621 M/s的吞吐量,比Intel的优化基数排序快1.5倍,比包含PCIe开销的Fermi GPU快1.24倍。
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.
研究动机与目标
- 提升现代x86架构上带宽受限的排序算法性能。
- 解决内存密集型排序中因写合并缓冲区有限和缓存污染导致的性能瓶颈。
- 证明标量、带宽优化的算法在与高度并行的GPU实现对比时仍具竞争力。
- 表明虚拟内存和软件写合并可用于在排序内核中实现接近峰值内存吞吐量。
提出的方法
- 使用虚拟内存为输出数组保留大块连续地址空间,避免缓存污染。
- 通过在L1缓存行中缓冲写入,再发出非临时存储,实现软件写合并。
- 应用非临时流式存储,将多个写入合并为单次突发传输,最小化总线开销。
- 通过将直方图计数替换为直接索引到预分配的每键缓冲区,优化计数排序。
- 使用SSE2内嵌函数实现高效的向量化加载和非临时存储操作。
- 通过内核模式访问Intel i7非核心性能计数器,测量内存带宽利用率。
实验结果
研究问题
- RQ1虚拟内存和软件写合并是否能显著提升现代x86系统上标量基数排序的吞吐量?
- RQ2软件写合并能在多大程度上缓解硬件写合并缓冲区的限制?
- RQ3在包含PCIe数据传输开销的情况下,高度优化的标量基数排序与Fermi GPU相比性能如何?
- RQ4使用这些技术的带宽受限排序内核可实现峰值内存带宽的多少比例?
- RQ5为何测量到的读流量比写流量高出约10%,这种不平衡的原因是什么?
主要发现
- 所提出的算法在32位整数键上实现了621 M/s的吞吐量,相比Intel报告性能(已调整双CPU且无超线程)提升1.5倍。
- 在32位值上,吞吐量达到430 M/s,表明计算是部分瓶颈,但内存带宽仍是主导因素。
- 该算法实现了理论峰值内存带宽的88%,在四轮操作中写入2041 MiB,读取2272 MiB。
- 写入之外额外的10%读流量尚不明确,需进一步研究。
- 尽管晶体管数量更少(1.46B vs. 3B)且热设计功耗更低(260W vs. 300W),在包含PCIe数据传输开销时,双CPU实现仍优于GTX 480 GPU。
- 测量到的带宽利用率表明进一步优化空间极小,因为内存操作耗时已接近理论最小值。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。