ARM NEON 上的一种混合向量化归并排序
A Hybrid Vectorized Merge Sort on ARM NEON
AI总结:
本文提出 ARM NEON 上的混合向量化归并排序 NEON-MS,通过优化寄存器使用、排序网络及串行与向量化归并结构,在 FT2000+ 单核上显著优于 std::sort 与 boost::block_sort。
摘要:
排序算法是计算机科学中被最广泛研究的主题,并服务于众多实际应用。尽管为提升效率已经提出了各种排序方法,但不同架构为并行排序的实现提供了不同特性。本文提出一种运行于 ARM NEON 上的混合向量化归并排序,简称为 NEON Merge Sort(NEON-MS)。具体而言,我们首先根据被授予的寄存器功能确定最优寄存器数量,以避免因中间结果写回而导致的寄存器到内存访问。更重要的是,在主要使用排序网络进行列排序、并使用归并网络执行三类向量化归并的通用归并排序框架下,我们进一步以统一的非对称方式改进其结构以实现高效率:1)使具有较少比较器的最优排序网络成为可能;2)串行归并与向量化归并的混合实现带来了归并指令高度交错的流水线。在单个 FT2000+ 核心上的实验表明,NEON-MS 平均分别比 std::sort 和 boost::block_sort 快 3.8 倍和 2.1 倍。此外,与后者的并行版本相比,NEON-MS 获得了 1.25 倍的平均加速比。
英文摘要:
Sorting algorithms are the most extensively researched topics in computer science and serve for numerous practical applications. Although various sorts have been proposed for efficiency, different architectures offer distinct flavors to the implementation of parallel sorting. In this paper, we propose a hybrid vectorized merge sort on ARM NEON, named NEON Merge Sort for short (NEON-MS). In detail, according to the granted register functions, we first identify the optimal register number to avoid the register-to-memory access, due to the write-back of intermediate outcomes. More importantly, following the generic merge sort framework that primarily uses sorting network for column sort and merging networks for three types of vectorized merge, we further improve their structures for high efficiency in an unified asymmetry way: 1) it makes the optimal sorting networks with few comparators become possible; 2) hybrid implementation of both serial and vectorized merges incurs the pipeline with merge instructions highly interleaved. Experiments on a single FT2000+ core show that NEON-MS is 3.8 and 2.1 times faster than std::sort and boost::block\_sort, respectively, on average. Additionally, as compared to the parallel version of the latter, NEON-MS gains an average speedup of 1.25.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。