IP Library Granted Patent US 12,585,399
Granted Patent B2
US 12,585,399 · App. 18/749,344 · Granted Mar 24, 2026

In-place sorting

Inventors: Trevor Gale (New York, NY); Albert Borchers (La Selva Beach, CA); Rastislav Bodik (Berkeley, CA); Danilo Carvalho Martins (Palo Alto, CA)
Assignee: GDM HOLDING LLC
G06F3/0647G06F3/0604G06F3/0673G06F7/26G06F3/0626
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 12,585,399
App. No.
18/749,344
Granted
Mar 24, 2026
Kind
B2
Abstract

Implementations described herein relate to improved in-place sample sorting of data. In various implementations, unsorted elements of a set stored in a first memory segment may be compared to splitter values to determine respective counts of elements of the set that will fit into each of a plurality of buckets bounded by the splitter values. Some number of elements from each of multiple ranges of the first memory segment that correspond to the multiple buckets may be moved to a smaller second memory segment. Remaining elements may be redistributed from at least some of the plurality of ranges of the first memory segment across the plurality of ranges based on comparing the remaining elements to the splitter values. The elements from the second memory segment may then be distributed across the plurality of ranges based on comparing the elements to the splitter values.

Claims (48)

1 . A method implemented using one or more processors and comprising:

comparing elements of a set of unsorted elements stored in a first memory segment to a plurality of splitter values;

based on the comparing, determining respective counts of elements of the set that will fit into each of a plurality of buckets bounded by the splitter values;

determining a predetermined number of elements to be moved from the first memory segment to a second memory segment that is smaller than the first memory segment;

moving, to the second memory segment, the same predetermined number of elements from each of a plurality of ranges of the first memory segment that correspond to the plurality of buckets;

while the predetermined number of elements remain in the second memory segment, redistributing remaining elements from at least some of the plurality of ranges of the first memory segment across the plurality of ranges based on comparing the remaining elements to the splitter values; and

distributing the elements from the second memory segment across the plurality of ranges based on comparing the elements to the splitter values.

2 . The method of claim 1 , further comprising:

sampling, from the set of unsorted elements stored in the first memory segment, a subset of the unsorted elements; and

analyzing the subset of the unsorted elements to select the plurality of splitter values.

3 . The method of claim 2 , wherein the sampling is random.

4 . The method of claim 1 , wherein redistributing the remaining elements comprises:

identifying the range of the first memory segment having the least free space after the moving;

selecting γ elements from the identified range; and

redistributing the γ elements across the plurality of ranges based on comparing the γ elements to the splitter values.

5 . The method of claim 4 , further comprising moving b i mod γ additional elements from at least one of the ranges of the first memory segment that corresponds to a given bucket i, of the plurality of buckets, that has b i elements.

6 . The method of claim 1 , further comprising determining the plurality of ranges of the first memory segment that correspond to the plurality of buckets.

7 . The method of claim 6 , wherein determining the plurality of ranges comprises assigning-read and write pointers to a portion of the first memory segment that corresponds to a boundary between two of the buckets.

8 . The method of claim 7 , wherein the moving comprises shifting one or more of the read pointers by the predetermined number.

9 . The method of claim 7 , wherein redistributing the remaining elements from at least some of the plurality of ranges of the first memory segment comprises shifting one or more of the write pointers.

10 . The method of claim 1 , further comprising filtering out a given range of the plurality of ranges that does not include remaining elements.

11 . The method of claim 10 , wherein the filtering comprises determining whether a read pointer assigned to the given range points to a first element of an adjacent range.

12 . A system comprising one or more processors and memory storing instructions that, in response to execution by the one or more processors, cause the one or more processors to:

compare elements of a set of unsorted elements stored in a first memory segment to a plurality of splitter values;

based on the comparing, determine respective counts of elements of the set that will fit into each of a plurality of buckets bounded by the splitter values;

determine a predetermined number of elements to be moved from the first memory segment to a second memory segment that is smaller than the first memory segment;

move, to the second memory segment, the same predetermined number of elements from each of a plurality of ranges of the first memory segment that correspond to the plurality of buckets;

while the predetermined number of elements remain in the second memory segment, redistribute remaining elements from at least some of the plurality of ranges of the first memory segment across the plurality of ranges based on comparing the remaining elements to the splitter values; and

distribute the elements from the second memory segment across the plurality of ranges based on comparing the elements to the splitter values.

13 . The system of claim 12 , further comprising instructions to:

sample, from the set of unsorted elements stored in the first memory segment, a subset of the unsorted elements; and

analyze the subset of the unsorted elements to select the plurality of splitter values.

14 . The system of claim 12 , wherein the instructions to redistribute comprise instructions to:

identify the range of the first memory segment having the least free space after the moving;

select γ elements from the identified range; and

redistribute the γ elements across the plurality of ranges based on comparing the γ elements to the splitter values.

15 . The system of claim 14 , further comprising instructions to move b i mod γ additional elements from at least one of the ranges of the first memory segment that corresponds to a given bucket i, of the plurality of buckets, that has b i elements.

16 . The system of claim 12 , further comprising instructions to determine the plurality of ranges of the first memory segment that correspond to the plurality of buckets.

17 . The system of claim 16 , wherein the instructions to determine the plurality of ranges comprise instructions to assign read and write pointers to a portion of the first memory segment that corresponds to a boundary between two of the buckets.

18 . The system of claim 12 , wherein the one or more processors comprise a systolic array of data processing units (DPUs).

19 . The system of claim 12 , wherein the one or more processors comprise a plurality of cores, each having less than or equal to 256 KB of private L2 cache.

20 . At least one non-transitory computer-readable medium comprising instructions that, in response to execution by one or more processors, cause the one or more processors to:

compare elements of a set of unsorted elements stored in a first memory segment to a plurality of splitter values;

based on the comparing, determine respective counts of elements of the set that will fit into each of a plurality of buckets bounded by the splitter values;

determine a predetermined number of elements to be moved from the first memory segment to a second memory segment that is smaller than the first memory segment;

move, to the second memory segment, the same predetermined number of elements from each of a plurality of ranges of the first memory segment that correspond to the plurality of buckets;

while the predetermined number of elements remain in the second memory segment, redistribute remaining elements from at least some of the plurality of ranges of the first memory segment across the plurality of ranges based on comparing the remaining elements to the splitter values; and

distribute the elements from the second memory segment across the plurality of ranges based on comparing the elements to the splitter values.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 13, 2025
From: DEEPMIND TECHNOLOGIES LIMITED
To: GDM HOLDING LLC
Reel/Frame 071550/0092 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jun 25, 2024
From: GALE, TREVOR; BORCHERS, ALBERT; BODIK, RASTISLAV; MARTINS, DANILO CARVALHO
To: DEEPMIND TECHNOLOGIES LIMITED
Reel/Frame 067832/0740 →
Continuity (1)
Related Publication 20250390245A1 · Dec 25, 2025
References Cited (11)
US 20150212797A1 · Bordawekar · 2015 [cited by examiner]
US 20240111826A1 · Chen · 2024 [cited by examiner]
GB 2284079A · 1995 [cited by examiner]
Axtmann, Michael, et al. In-Place Parallel Super Scalar Samplesort (IPS$ [cited by examiner]
Schöner, Sebastian. “A Sort of Sorts—Parallel Sorting with Sample Sort.” Sebastian Schöner, May 24, 2021, https://blog.s-schoener.com/2021-05-24-parallel-sorting/ (Year: 2021). [cited by examiner]
PassMark—Intel Xeon E5-4640 @ 2.40GHz—Price Performance Comparison. Feb. 15, 2024, https://web.archive.org/web/20240215014426/https://www.cpubenchmark.net/cpu.php?cpu=Intel+Xeon+E5-4640+%40+2.40GHz&id=1224. (Year: 2024). [cited by examiner]
Blacher et al., “Vectorized and performance-portable Quicksort” arXiv:2205.05982v1 [cs.IR], 21 pages, dated May 12, 2022. [cited by applicant]
Gale et al., “Bounds for a Continuous Balls and Bins Problem” 5 pages, dated Feb. 21, 2024. [cited by applicant]
European Patent Office, Communication issued in Application No. 25179598.5, 8 pages, dated Nov. 17, 2025. [cited by applicant]
Axtmann M., et al.; Engineering In-place (Shared-memory) Sorting Algorithms ACM Transactions On Parallel Computing, vol. 9, No. 1, pp. 1-62, XP058690826, dated Jan. 31, 2022. [cited by applicant]
Blelloch G., et al.: “Sorting with 1-15 Asymmetric Read and Write Costs”, Arxiv.Org, XP080688610, DOI: 10.1145/2755573.2755604, 23 pages, dated Mar. 11, 2016. [cited by applicant]