Multiway Merging Sort with Index Pairing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing sorting methods for large arrays face high processing loads due to memory copy overhead and cache misses, particularly when using direct data sorting or pair sorting techniques, which hinder efficient processing and memory bandwidth utilization.
Innovation Solution
The implementation of a multiway merging process that generates a single output sequence from multiple input sequences without rearranging elements, using a storage unit to store the array and a sorted-array generation unit to produce input sequences by pairing keys with indices, allowing for iterative processing to generate a sorted array without moving data during sorting.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If direct data sorting is used, then sorting can be performed on actual data elements, but repetitive memory copying occurs leading to large overhead
Solution Approach 1:
The patent creates index copies instead of data copies. It pairs key values with index values representing positions of data elements, sorts these index pairs, and then uses the sorted indices to rearrange the original data. This approach copies only lightweight index structures rather than the actual large data elements, dramatically reducing memory copy overhead while maintaining sorting functionality.
2Productivity
If direct data sorting is used, then data can be sorted by key values, but discontinuous memory accesses occur making SIMD instructions difficult to apply
Solution Approach 1:
The patent separates the sorting operation from the data movement operation. It creates a copy of index values paired with keys, performs sorting on this index structure, and then uses the resulting sorted indices to access and rearrange original data in a systematic sequence. This transformation converts discontinuous random memory accesses during sorting into sequential accesses, enabling efficient SIMD instruction application.
3Productivity
If pair sorting with index rearrangement is used, then SIMD instructions can be applied for efficient processing, but random cache accesses occur leading to numerous cache misses
Solution Approach 1:
The patent performs preliminary sorting of index pairs to establish the final sorted order before any data rearrangement occurs. By pre-computing the sorted sequence of indices based on key values, it creates a roadmap that guides subsequent data movement. This preliminary action ensures that when data is rearranged, it follows a predetermined sequence that minimizes cache misses and maximizes memory access efficiency.
4Productivity
If parallel memory accesses are performed in the final sorting process, then sorting speed can be increased, but memory bandwidth becomes a bottleneck
Solution Approach 1:
The patent copies only index information rather than actual data elements during sorting operations. Since indices are small integer values, multiple index copies can be made and sorted in parallel with minimal memory bandwidth consumption. The actual large data elements are moved only once in the final rearrangement step, dramatically reducing total memory bandwidth usage while maintaining high sorting throughput through efficient parallel index processing.
Data Source
AI summary
Sorting an array consisting of large number of elements. The present invention provides an apparatus for executing a multiway merging process which generates one output sequence from N input sequences on an array consisting of a large number of elements. The apparatus includes: an execution unit configured to execute the multiway merging process on N input sequences without rearranging the elements based on a plurality of input sequences; and a generation unit configured to rearrange the elements constituting the input sequences according to an output sequence that has been generated by the multiway merging process in the execution unit so as to generate a sorted array of elements.


