[Paper Review] Merge Path - A Visually Intuitive Approach to Parallel Merging
This paper introduces the Merge Path algorithm, a visually intuitive method for parallel merging of two sorted arrays by modeling the merge process as a path on a grid, enabling load-balanced, synchronization-free, and cache-efficient parallel merging. The approach achieves near-linear speedup on shared-memory systems and enables efficient cache-aware sorting, particularly effective on architectures like Plurality's HyperCore.
Merging two sorted arrays is a prominent building block for sorting and other functions. Its efficient parallelization requires balancing the load among compute cores, minimizing the extra work brought about by parallelization, and minimizing inter-thread synchronization requirements. Efficient use of memory is also important. We present a novel, visually intuitive approach to partitioning two input sorted arrays into pairs of contiguous sequences of elements, one from each array, such that 1) each pair comprises any desired total number of elements, and 2) the elements of each pair form a contiguous sequence in the output merged sorted array. While the resulting partition and the computational complexity are similar to those of certain previous algorithms, our approach is different, extremely intuitive, and offers interesting insights. Based on this, we present a synchronization-free, cache-efficient merging (and sorting) algorithm. While we use a shared memory architecture as the basis, our algorithm is easily adaptable to additional architectures. In fact, our approach is even relevant to cache-efficient sequential sorting. The algorithms are presented, along with important cache-related insights.
Motivation & Objective
- To address the challenge of efficiently and correctly parallelizing the merging of two sorted arrays in shared-memory architectures.
- To minimize load imbalance, inter-thread synchronization, and memory overhead in parallel merge operations.
- To develop a cache-efficient merging algorithm that reduces memory access bottlenecks in high-performance sorting.
- To enable efficient parallel sorting by leveraging intuitive partitioning of input arrays based on geometric path traversal.
- To demonstrate applicability and performance gains on modern parallel architectures, including those with large core counts and shared caches.
Proposed method
- Model the merge process as a path on a grid from top-left to bottom-right, where each step corresponds to selecting an element from one of the two input arrays.
- Use the Merge Path to partition the two input arrays into contiguous segments such that merging corresponding pairs yields the correct sorted output.
- Parallelize the computation of partition points along the Merge Path using binary search on cross-diagonals, ensuring load balance across cores.
- Design a lock-free, synchronization-free algorithm that avoids false sharing and maintains high cache efficiency on both private- and shared-cache architectures.
- Extend the basic algorithm to a segmented version that improves performance on direct-mapped caches by reducing cache conflicts.
- Adapt the algorithm to various architectures, including PRAM and modern many-core systems like Plurality’s HyperCore, via a task-based programming model.
Experimental results
Research questions
- RQ1How can two sorted arrays be partitioned into segments such that merging corresponding pairs produces a single sorted array, while ensuring load balance across parallel cores?
- RQ2What geometric or visual representation can simplify the design and understanding of parallel merge algorithms?
- RQ3How can memory access patterns be optimized to reduce cache misses and coherence overhead in parallel merging?
- RQ4To what extent can a synchronization-free, load-balanced merge algorithm achieve near-linear speedup on modern many-core systems?
- RQ5How does the segmented variant of the algorithm improve performance on systems with limited or direct-mapped caches?
Key findings
- The Merge Path approach enables a correct, load-balanced, and synchronization-free parallel merge by modeling the merge process as a path traversal on a grid.
- The algorithm achieves near-linear speedup on up to 16 cores across various input sizes, with performance degradation only observed at 32 cores due to shared-memory contention.
- The segmented version of the algorithm shows improved performance on direct-mapped caches, reducing cache conflicts and enhancing throughput.
- On the Plurality HyperCore FPGA prototype, the algorithm's low thread dispatch latency allows efficient execution even on small input arrays, minimizing overhead.
- The cache-efficient variant of the algorithm significantly reduces memory subsystem bottlenecks, making it suitable for high-performance sorting on memory-bound workloads.
- The geometric insight of the Merge Path provides a clear, intuitive foundation for understanding and implementing parallel merge algorithms, facilitating both teaching and implementation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.