MASH Sort · GPU + CPU Adaptive Sorting

The sort at the end of every query is your hidden bottleneck.

Every retrieval, every ORDER BY, every top-k ends in a sort over millions of scores. CUB is one-size-fits-all — and leaves speed on the table the moment your data has structure.

MASH fingerprints your data and routes it — up to 20× faster than CUB, never slower.
20x
Presorted
4.4x
Dictionary
3.2x
RAG scores

Watch It Beat CUB — Live

90 seconds, no edits, no hand-picked numbers. Every result is measured live on the GPU and verified correct against std::sort before its speed is shown.

unedited · measured live on RTX PRO 6000 Blackwell · verified against std::sort  ·  watch on YouTube

The One-Size-Fits-All Problem

NVIDIA CUB and Thrust are the industry standard for GPU sorting. They use radix sort, excellent for uniform random data, but blind to real-world structure.

Real data has topology: time series are monotonic, user IDs follow Zipfian distributions, logs arrive nearly-sorted. Using one algorithm for everything leaves 73% of potential performance on the table.

Use MASH when…

If any of these is your problem, the sort is costing you more than you think.

Your top-k sort is the bottleneck at the end of retrieval

Every RAG query ends in a top-k sort over millions of similarity scores. You optimized the model and the index — the sort is the step you never profiled.

3.2× faster on RAG scores (B300)

CUB leaves speed on the table when your data has structure

Radix sort is blind to topology. MASH fingerprints your data and routes presorted, reverse, and Zipfian distributions to specialized kernels that exit early instead of brute-forcing every key.

adaptive routing → up to 20× on real-world data

You can't risk a sort that's sometimes slower

"Faster on average" is unacceptable in production. MASH matches CUB on uniform random and wins everywhere there's structure — every result measured live on the GPU and verified element-for-element against std::sort.

never slower than CUB · verified live

How MASH Works

MASH is smart, not just fast. It adapts to your data automatically.

STEP 1

Fingerprint

Zero-Overhead Analysis

Analyzes data entropy, sortedness, and distribution during host-to-device transfer.

STEP 2

Intelligent Router

O(1) Adaptive Logic

Instantly selects the optimal algorithm based on data shape. No manual tuning required.

STEP 3

Execute

Specialized Kernels

Executes one of 7 specialized algorithms (SIMD/Warp optimized) for maximum throughput.

How It Performs

Visualized benchmark results. See how MASH routes different data distributions to specialized algorithms.

Benchmark Visualization 100,000 integers
std::sort --
MASH (CPU) --
> Select a data distribution to begin...

Throughput Comparison

std::sort ~2M items/sec
MASH CPU ~15M items/sec
MASH GPU ~800M items/sec

The visualization above shows CPU benchmark results. The same adaptive routing logic scales to massive GPU parallelism.

MASH GPU achieves up to 8 GB/s throughput, 53x faster than CPU.

License MASH GPU

GPU + CPU

Production-ready implementations for both platforms. Route intelligently based on workload.

GPU Implementation

Production Ready

Codebase 3,553 LOC
CUDA Version 11.0+
Compute Capability 7.0+ (Volta)
Tested Hardware RTX PRO 6000, GB10, A10G
Graph Capture +27% batch
Memory Model Zero-alloc hot path

CPU Implementation

Production Ready

Algorithms Adaptive
Standard C++20
Parallelization OpenMP 4.5+
Platform x86-64 Linux
Routing Cost-model based
GPU Coordination Hybrid router

Performance Benchmarks

1 billion uint64 keys on a single NVIDIA B300, device-resident (data prestaged on the GPU, transfer excluded). Compared against NVIDIA CUB; every run verified element-for-element against std::sort. Speedups are hardware-specific.

BENCHMARK_RESULTS.log
Distribution CUB Time MASH Time Speedup
Presorted 48.32 ms 2.42 ms 19.99x
Dictionary (tiny range) 43.91 ms 10.09 ms 4.35x
Narrow range (14-bit) 45.27 ms 14.00 ms 3.24x
RAG scores (retrieval) 45.38 ms 14.07 ms 3.23x
Reverse 48.31 ms 27.30 ms 1.77x
Strided IDs 46.69 ms 27.58 ms 1.69x
Uniform Random 55.18 ms 55.22 ms 1.00x
Tied on unstructured (uniform) data — no structure to exploit. Up to ~20× where structure exists. Never slower than CUB. Device-resident throughput holds at ~18 Gkeys/s (~145 GB/s), flat to 8 B keys.

All results reproducible with one-click verification scripts. Cryptographic Merkle chain ensures integrity.

Design Partner

Pricing

This is a design-partner product. Pricing is scoped to your workload and deployment, not a fixed list, and design partners get founder-level access and first-mover terms.

Technical Specifications

Requirements and tested configurations.

SPECIFICATIONS.txt
Requirement GPU CPU
Runtime CUDA 11.0+ C++20, OpenMP
Hardware CC 7.0+ (Volta) x86-64
Tested GPUs RTX PRO 6000, GB10, A10G -
Data Types uint64_t uint64_t
Memory N×8 bytes temp N×8 bytes temp
Platform Linux Ubuntu 20.04+

Built For Real Workloads

Where that structure actually lives — and the fingerprint signal MASH routes on.

Time-Series Databases

Time-series data is naturally ordered. MASH detects presorted structure and exits in up to 20x less time.

sortedness > 235 → instant exit

Analytics Engines

ORDER BY operations on user activity follow Zipfian distributions. MASH sorts only the bits that actually carry information.

narrow key range → 3.2x speedup

Log Processing

Timestamp-ordered logs arrive nearly sorted. Fingerprinting detects this and skips unnecessary work.

run detection → merge only

Financial Systems

Order books and trade data have local structure. Adaptive routing exploits patterns automatically.

effective_bits routing → fewer passes

Use case · Agentic RAG

The sort hiding in your retrieval pipeline

Every retrieval ends in a top-k sort over millions of similarity scores. On quantized scores (the billion-vector norm) MASH sorts them about 3× faster than CUB — measured live, verified against std::sort. We time the sort step, not the model.

watch on YouTube

Ready to Get Started?

Start with a free 30-day trial. Prove the speedup. Become the internal champion.