IP Library Granted Patent US 8,261,043
Granted Patent B2
US 8,261,043 · App. 12/464,213 · Granted Sep 4, 2012

SIMD merge-sort and duplicate removal operations for data arrays

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,261,043
App. No.
12/464,213
Granted
Sep 4, 2012
Kind
B2
Abstract

A method and apparatus are provided to perform efficient merging operations of two or more streams of data by using SIMD instruction. Streams of data are merged together in parallel and with mitigated or removed conditional branching. The merge operations of the streams of data include Merge AND and Merge OR operations.

Claims (30)

1. A method for performing high speed merging and sorting of two or more data streams comprising:

loading a first set of sorted data elements from a first sorted input stream into a first hardware vector register, and loading a second set of sorted data elements from a second sorted input stream into a second hardware vector register, wherein the quantity of data elements loaded into the first register is equal to the quantity of data elements loaded into the second register;

using single instruction multiple data (SIMD) instructions for performing a merge sort operation resulting in combining data elements loaded into said vector registers into a single sorted sequence, said merge sort operation based upon comparison of data elements from the first and second vector registers;

placing first and second portions of the single sorted sequence into the first and second vector registers, respectively, wherein the first vector register contains a first sorted portion of the sequence with smaller data elements and the second vector register contains a second sorted portion of the sequence with larger data elements;

placing contents of the first vector register with the smaller data elements into a single output stream; and

loading a next set of sorted data elements from one of the input streams into the first vector register and repeating the merge sort operation and output of sorted data elements into the single output stream until the input streams are completely merged, including removing duplicate data elements from the single output stream in an operation selected from the group consisting of: removing duplicate data elements collectively when the first and second input streams are completely merged, and removing duplicate data elements by comparing proximate elements each time elements of the first vector register are placed into the single output stream.

2. The method of claim 1 , further comprising denoting a position to read a next data element with a pointer and advancing a position of the pointer after loading data elements from one of the input streams.

3. The method of claim 2 , further comprising comparing a first element after the pointer in the first input stream to a first element after the pointer in the second input stream and loading, into the first vector register, data elements from an input stream with a smaller first element.

4. The method of claim 1 , wherein the merge sort operation is performed by invoking a SIMD instruction selected from the group consisting of: a vector minimum instruction and a vector maximum instruction.

5. A computer system comprising:

a single instruction multiple data (SIMD) processor configured to employ Virtual Machine Extensions (VMX) instructions to perform high speed merging and sorting of two or more data streams, the instructions comprising:

instructions to load a first set of sorted data elements into a first hardware vector register from a first sorted input stream;

instructions to load a second set of sorted data elements into a second hardware vector register from a second sorted input stream, wherein the quantity of loaded elements is constant;

SIMD instructions to perform a merge sort operation resulting in combining data elements loaded into said vector registers into a single sorted sequence, said merge sort operation based upon comparison of data elements from the first and second vector registers;

instructions to place first and second portions of the single sorted sequence into the first and second vector registers, respectively, wherein the first vector register contains a first sorted portion of the sequence with smaller data elements and the second vector register contains a second sorted portion of the sequence with larger data elements;

instructions to place contents of the first vector register into a single output stream; and

instructions to load a next set of sorted data elements from one of the input streams into the first vector register and to repeat the merge sort operation and output of sorted data elements into the single output stream until the input streams are completely merged, including removing duplicate data elements from the single output stream in an operation selected from the group consisting of: removing duplicate data elements collectively when the first and second input streams are completely merged, and removing duplicate data elements by comparing proximate elements each time elements of the first vector register are placed into the single output stream.

6. The system of claim 5 , further comprising a pointer to denote a position to read a next data element and instructions to advance the pointer to read the next data element after loading a certain number of data elements from one of the input streams.

7. The system of claim 6 , further comprising instructions to compare a first element after the pointer in the first input stream to a first element after the pointer in the second input stream, and to load the constant number of data elements into the first vector register from an input stream with a smaller first element.

8. The system of claim 5 , wherein the merge sort operation is performed by invoking a SIMD instruction selected from the group consisting of: a vector minimum instruction, and a vector maximum instruction.

9. An article comprising:

a computer readable data storage device, including computer program instructions configured to perform high speed merging and sorting of two or more data streams, the instructions comprising:

instructions to load a set number of sorted data elements into a first hardware vector register from a first sorted input stream;

instructions to load the set number of sorted data elements into a second hardware vector register from a second sorted input stream;

single instruction multiple data (SIMD) instructions to perform a merge sort operation for combining data elements loaded into said vector registers into a single sorted sequence, said merge sort operation based upon comparison of data elements from the first and second vector registers;

instructions to place first and second portions of the single sorted sequence into the first and second vector registers, respectively, wherein the first vector register contains a portion of the sequence with smaller data elements and the second vector register contains a portion of the sequence with larger data elements;

instructions to place contents of the first vector register into a single output stream; and

instructions to load a next set of sorted data elements from one of the input streams into the first vector register and instructions to repeat the merge sort operation and output of sorted data elements into the single output stream until the input streams are completely merged, including removing duplicate data elements from the single output stream in an operation selected from the group consisting of: removing duplicate data elements collectively when the first and second input streams are completely merged, and removing duplicate data elements by comparing proximate elements each time elements of the first vector register are placed into the single output stream.

10. The article of claim 9 , further comprising instructions to advance a pointer denoting the position to read a next data element after loading the set number of data elements from one of the input streams.

11. The article of claim 10 , further comprising instructions to compare a first element after the pointer in the first input stream to a first element after the pointer in the second input stream, and to load the set number of data elements into the first register from an input stream with a smaller first element.

Assignments (2)
CHANGE OF NAME Recorded Aug 26, 2014
From: SAP AG
To: SAP SE
Reel/Frame 033625/0334 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 12, 2012
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: SAP AG
Reel/Frame 028540/0522 →