Docs · Unum

Build with Unum.

Choose an engine or a core library, then go straight to the interface you use.

The Stack

14 languages, one ABI, three engines and UCall, four libraries

USearch and UStore share one C ABI and commit together. UForm turns raw bytes into the vectors USearch indexes, and UCall serves any C function over the network. Beneath them, four libraries each solve one hardware problem once. Hover a box, edge or legend entry to trace what flows where.

Bindings

  • C997
  • C++206
  • Rust 1.1007
  • Mojo 1.25
  • Python 3.127
  • Zig 0.162
  • Swift 6.44
  • Go 1.243
  • Java 25 · Kotlin · Scala2
  • C# 142
  • JavaScript ES20204
  • Wolfram1

Stable C ABI

opaque handles · a status from every call · no exceptions across it

Engines

Libraries

Hardware

CPUs x86 AVX2 · AVX-512 · AMXArm NEON · SVE · SVE2 · SMERISC-V RVV · LoongArchPower · WebAssembly
IO Linux io_uring · SPDK · epollWindows IoRing · IOCP · RIOmacOS & FreeBSD kqueueGPUDirect Storage · RDMA
GPUs NVIDIA Ampere · AdaHopper · Blackwell · RubinAMD CDNA4 · CDNA5Apple M1 · M3 · M5 via Metal
  1. NumKong
    1. 1

      → UForm The tensor substrate: mixed-precision kernels for training and PyTorch-free inference.

    2. 2

      → USearch Distance, GEMM and attention kernels with CPU and CUDA tiers.

  2. StringZilla
    1. 3

      → UForm Parses the payloads exchanged between loaders, trainers and checkpoints.

    2. 4

      → USearch Levenshtein, Needleman-Wunsch and Smith-Waterman kernels behind the sequence modality.

    3. 5

      → UStore Hashing, sorting and fuzzy matching of keys and strings.

    4. 6

      → UCall Parsing, and the AES-256-GCM and SHA-256 primitives behind the Noise handshake.

  3. ForkUnion
    1. 7

      → UForm The host-side thread pool that decodes and demultiplexes batches for the GPUs.

    2. 8

      → USearch Parallel add and refine, NUMA pinning and capped waits.

    3. 9

      → UStore Engine thread pools, the verification runner and weak-memory models.

  4. SmashTable
    1. 10

      → USearch Transactional containers for staged insertion, and GPU atomic hash tables.

    2. 11

      → UStore Transactional containers, staging and committing across collections.

    3. 12

      → UCall Hash indexes over descriptors, keep-alive lists and lock-free stacks of reply segments.

Each binding names the oldest language or runtime version a project targets, and its badge counts how many of the eight projects ship it.

02

Locality over disaggregation

We keep data on local NVMe, next to the cores that read it. The engine, not the page cache, decides what stays hot: a graph’s entry points and a one-off scan need different policies. Keeping that choice out of the page cache makes IO work visible on the query path.

Mechanisms

Direct IO
O_DIRECT reads into aligned engine buffers, so the engine decides which data stays hot.
Asynchronous IO
io_uring batches requests; registered buffers and SQPOLL reduce overhead on the query path.
User-space queues
SPDK submits NVMe commands from user space and polls completions on a dedicated core.
GPUDirect Storage
cuFile reads pages from NVMe into VRAM, avoiding an intermediate copy through host memory.

Fig. 2.1Local NVMe answers 375× sooner than S3

  • on the machine
  • across the network
Who controls a local read?
IO pathOn a cache missTrade-off
Kernel-managed cacheThe OS decides which file pages stay in memory.
Buffered preadA system call reads into the page cache, then copies into the application buffer.Simple file IO; the calling thread waits for the read to finish.
mmapTouching a missing page faults it into memory before the thread can continue.Cached data needs no explicit read or copy; misses interrupt ordinary memory access.
Engine-managed cacheThe engine owns its buffers and chooses what to retain.
pread + O_DIRECTA system call reads into an aligned application buffer, bypassing the page cache.Explicit reads and cache policy; the calling thread still waits.
io_uring + O_DIRECTThe engine queues reads and handles completions while other work continues.Batching and concurrency through the kernel; registered buffers and SQPOLL can reduce per-read overhead.
SPDKThe engine submits NVMe commands and polls completions through a user-space driver.Bypasses the kernel storage stack; requires device ownership, DMA buffers and CPU time for polling.
GPUDirect StoragecuFile reads from NVMe straight into VRAM, skipping a copy through host memory.Needs an NVIDIA GPU and a supported driver and filesystem; otherwise reads bounce through a host buffer.

Direct IO bypasses the page cache; it does not by itself guarantee durability. The engine still needs write ordering and flushes. Throughput depends on the drive, queue depth and workload.

API details: O_DIRECT ↗ mmap ↗ io_uring ↗ SPDK ↗ GPUDirect Storage ↗

Above, typical access latency on a log scale, relative to DRAM. Below, local IO paths grouped by cache ownership: direct IO changes who manages the data, asynchronous IO changes how reads are scheduled, SPDK moves the driver into user space, and GPUDirect Storage reads straight into VRAM.
03

Wider, not faster

We write kernels for each vector ISA and select them at runtime. Register width, register count and execution ports all shape how much work fits in flight. Wider vectors can also lower the core clock, so each kernel balances parallelism against the throughput of the CPU running it.

Fig. 3.1Every ISA’s register file needs its own kernel

From vectors to matrix tiles

Register capacity sets the working space. Instructions, dependencies and execution ports decide how quickly work moves through it.

SSE / AVX

SSE family: 16 × 128 bits · 256 B

AVX2: 16 × 256 bits · 512 B

XMM and YMM alias the same registers. AVX introduces 256-bit floating-point vectors; AVX2 extends integer operations.

AVX-512

32 × 512 bits · 2 KiB

Twice the registers and twice the width of AVX2, plus eight mask registers that predicate every lane, so compress, expand and masked tails need no scalar loop.

AMX

8 configurable tiles · up to 8 KiB

Tile shape is configured for the packed matrix operands; each tile holds up to 1 KiB.

SSE / AVX · 128–256-bit vectors

WestmereSSE4.2 · AES
Byte comparisons and carry-less multiplication support string scans and hashing.
GoldmontSHA
Dedicated hash instructions add capabilities independently of vector width.
HaswellAVX2 · FMA · F16C
Converts FP16 before F32 arithmetic; integer and shuffle paths provide the baseline.
Alder LakeAVX-VNNI
Adds unsigned × signed integer dot products without requiring AVX-512.
Sierra ForestAVX-VNNI-INT8
Native signed × signed and unsigned × unsigned dots avoid sign-correction work.

AVX-512 / AVX10 · 512-bit vectors

SkylakeF · BW · DQ · VL
Masks, more registers and wide floating-point arithmetic.
Ice LakeVNNI · VBMI · population count
Integer dots, byte lookups and binary distances use different instructions.
GenoaBF16 dot products
Widens paired BF16 products into F32; also serves Intel CPUs with the same feature.
TurinVP2INTERSECT
Matches sparse-set elements directly instead of emulating intersections.
SapphireFP16 arithmetic
Native half-precision arithmetic and conversion expand the mixed-precision paths.
DiamondAVX10.2
Native FP8-to-FP16 conversion and widening FP16 dots change the decode-and-accumulate path.

AMX · matrix tiles

Sapphire AMXINT8 · BF16 tiles
Packed matrix operands feed tile dot products instead of vector FMAs.
Granite AMXFP16 tiles
Adds FP16 tile products, including more precise FP8-to-FP16 packing paths.
Diamond AMXFP8 · tile/vector movement
New matrix formats and movement instructions justify another tile backend.
Hover, focus or select a tab to compare vector and matrix register files. Register views alias where noted.

Sources NumKong v8 capabilities · Intel intrinsics · Arm SIMD · RISC-V vectors · IBM POWER · vaddps ports · vfmadd231ps ports

Put every lane and execution port to work

Start with the whole loop: its last partial vector, its dependency chains and the scalar work around it. Then schedule the instructions for the core that will run them.

  • Replace serial tails with predicated loads. Mask the last partial vector in a scan, comparison or reduction instead of switching to a byte-at-a-time epilogue. Load only valid lanes and give inactive lanes a neutral value. AVX-512, SVE and RVV can keep the final iteration on the vector path.
  • Interleave work across execution ports. Fuse independent reductions such as sum(a) and sum(b × c), then schedule their adds and FMAs together. With 256-bit AVX/FMA, Zen 4 routes vaddps to FP23 and vfmadd231ps to FP01; Skylake shares p01. The same ISA therefore needs different instruction mixes and unrolling to reach each chip’s throughput.
  • Account for frequency licenses. Benchmark a vector burst together with the scalar code around it. Under AVX frequency licenses, heavy FMA work lowers the clock past the burst, so a narrower kernel can win end to end.
  • Widen accumulators before they overflow. Keep compact inputs while accumulating i8 products into i32, or f16 and bf16 into f32. Split long dependency chains across independent accumulators, then combine them. Choose the count from measured latency and register pressure, and check the resulting rounding error.
  • Dispatch on the features the operation needs. Select byte shuffles and cryptographic instructions for StringZilla, row-search kits for SmashTable, extended atomics for ForkUnion and arithmetic kernels for NumKong. Register width alone cannot tell you whether a chip supports the required operation; retain a portable implementation for the remaining cases.
04

Heterogeneous by default

Matrix operations use different issue groups on different GPUs: a warp on Ampere, four warps on Hopper, a single issuing thread on Blackwell, a wavefront on AMD. We write kernels for those execution models from one source tree, then place each workload according to its bandwidth and latency needs.

Fig. 4.1Each GPU issues work at its own granularity

NVIDIA Volta2017

mma.sync.m8n8k4

Scheduling dense linear algebra

32-thread warp

1 CTA · 1 SM

Where matrix operands live

A
General Registers
B
General Registers
Result
General Registers

Stage operands

Loads stage matrix operands in registers; groups of eight threads cooperate within the warp.

Complete and read out

All warp threads participate in the synchronous matrix instruction. Results return to registers.

NVIDIA Ampere2020

mma.sync

Scheduling dense linear algebra

32-thread warp

1 CTA · 1 SM

Where matrix operands live

A
General Registers
B
General Registers
Result
General Registers

Stage operands

cp.async copies Device → Shared Memory; loads then move operands into General Registers.

Complete and read out

cp.async.wait_group waits for copies. Matrix issue is warp-synchronous; results stay in General Registers.

NVIDIA Ada2022

mma.sync · FP8

Scheduling dense linear algebra

32-thread warp

1 CTA · 1 SM

Where matrix operands live

A
General Registers
B
General Registers
Result
General Registers

Stage operands

cp.async copies Device → Shared Memory; loads then move operands into General Registers.

Complete and read out

cp.async.wait_group waits for copies. Matrix issue is warp-synchronous; results stay in General Registers.

NVIDIA Hopper2022

wgmma.mma_async

Scheduling dense linear algebra

128-thread warpgroup

1 CTA · 1 SM

Where matrix operands live

A
Shared Memory or General Registers
B
Shared Memory
Result
General Registers

Stage operands

TMA stages Device → Shared Memory and signals completion through mbarrier.

Complete and read out

wgmma.wait_group waits for matrix work independently of TMA completion. Accumulators live in General Registers.

NVIDIA Blackwell2024

tcgen05.mma

Scheduling dense linear algebra

1 issuing thread

1–2 CTAs · 1–2 SMs

Where matrix operands live

A
Shared Memory or Tensor Memory
B
Shared Memory
Result
Tensor Memory

Stage operands

TMA stages operands in Shared Memory. One issuing thread launches matrix work over one or two CTAs/SMs.

Complete and read out

mbarrier signals matrix completion. Warp-collective tcgen05.ld moves Tensor Memory results into General Registers; allocation is also warp-collective.

NVIDIA Blackwell RTX2025

mma.sync · f8f6f4 · mxf4

Scheduling dense linear algebra

32-thread warp

1 CTA · 1 SM

Where matrix operands live

A
General Registers
B
General Registers
Result
General Registers

Stage operands

cp.async copies Device → Shared Memory; loads then move operands into General Registers.

Complete and read out

cp.async.wait_group waits for copies. Warp-wide MMA supports FP8, FP6 and block-scaled FP4; results stay in General Registers.

AMD CDNA 42025

mfma

Scheduling dense linear algebra

64-thread wavefront

1 compute unit

Where matrix operands live

A
Vector / Accumulation Registers
B
Vector / Accumulation Registers
Result
Vector / Accumulation Registers

Stage operands

Direct Device → Shared Memory (LDS) copies bypass vector registers. MFMA still consumes register operands.

Complete and read out

Wait for memory loads and observe register hazards before consuming matrix results.

AMD CDNA 52026

wmma · f8f6f4

Scheduling dense linear algebra

32-thread wavefront

1 compute unit

Where matrix operands live

A
Vector / Accumulation Registers
B
Vector / Accumulation Registers
Result
Vector / Accumulation Registers

Stage operands

Direct Device → Shared Memory (LDS) copies bypass vector registers. WMMA consumes register operands; multiple waves can cooperate on a larger matrix tile.

Complete and read out

Wait for memory loads and observe register hazards before consuming matrix results.

Apple GPU family 92023

simdgroup_matrix

Scheduling dense linear algebra

32-thread SIMD-group

1 SIMD-group

Where matrix operands live

A
SIMD-group Matrix
B
SIMD-group Matrix
Result
SIMD-group Matrix

Stage operands

simdgroup_load / store move matrices to and from Device or Threadgroup Memory.

Complete and read out

Use uniform SIMD-group control flow. Metal leaves the per-thread element mapping unspecified.

Apple GPU family 102025

matmul2d · cooperative tensors

Scheduling dense linear algebra

4 × 32-thread SIMD-groups

1 threadgroup

Where matrix operands live

A
Cooperative Tensor
B
Cooperative Tensor
Result
Cooperative Tensor

Stage operands

Cooperative tensor kernels stage tiles in Threadgroup Memory; low-precision inputs can widen into FP16 before matrix work.

Complete and read out

Four SIMD-groups cooperate on matmul2d to use the Neural Accelerators. Cooperative tensor extents bound partial tiles.

  • One issuing thread
Page through to compare issue groups, operand storage and synchronization. CTA = thread block; SM = streaming multiprocessor. Transfer completion and matrix completion are separate.

Sources NVIDIA PTX · CUDA async copies · AMD CDNA 4 · Metal · NVIDIA generations · AMD generations · Apple M3 · Apple M5

Reshape the workload to fill the GPU

On a GPU, scheduling instructions is not enough: a workload's state must be split across threads, registers and a small shared-SRAM budget. Expose parallel work, balance irregular inputs and keep enough warps resident to hide latency.

  • Budget registers and shared SRAM together. Choose a tile from the live state it needs: operands, accumulators, lookup tables and pipeline buffers. Larger tiles improve reuse but consume more registers and shared memory per block, leaving fewer warps resident. Measure spills and active warps; aim for enough occupancy to hide latency without sacrificing useful work per thread.
  • Balance work across differently shaped inputs. Bucket short and long strings, split large alignments into tiles and distribute long hash scans across threads. A warp that waits for its longest input wastes the remaining lanes. Tune thread, warp and block mappings by shape, and keep only the active recurrence frontier in the small shared-SRAM budget.
  • Pipeline transfers without staging registers. Use cp.async or TMA to move global-memory tiles directly into shared memory. Bypassing temporary staging registers leaves more register capacity for computation. Double-buffer tiles to overlap the next transfer with current work; wait for transfer completion before reading and for consumers before reusing a buffer.
  • Borrow packed instructions from other workloads. Use video-SIMD byte and halfword min/max/add operations for sequence-alignment cells, as StringZilla does. Use DP4A when the calculation really is four 8-bit products accumulated into a 32-bit integer, including packed counts or scores. Bound each lane’s range before packing: saturation and overflow change the algorithm.
  • Match the recurrence before reaching for DPX. Hopper’s DPX fuses add/min/max for edit distance and alignment. Check the algebra before reusing it: Schulze voting in ScalingElections needs max(current, min(left, right)), which all-min or all-max DPX cannot fuse, though the tiling still transfers.
  • Use FP64 units for exact integer hashing. StringZilla’s MinHash kernels use double-precision FMA and reciprocal-based modular reduction for bounded rolling-hash states. Keep every intermediate within the proven exact-integer range, correct the remainder and test boundary values. This can put FP64 hardware to work on string fingerprints; compare integer alternatives on GPUs with weak FP64 throughput.
05

Placement over allocation

Memory is allocated up front, on the node that uses it, and almost never through a global allocator on a hot path. When data has to reach a GPU or an SSD, the transfer is scheduled, pipelined and overlapped with the rest of the execution.

Mechanisms

NUMA placement
ForkUnion pins workers to NUMA nodes and uses first-touch allocation to place pages near their consumers.
Huge pages
Fewer TLB misses when a graph or a table spans tens of gigabytes.
Local arenas
Allocate per-index and per-thread arenas up front, then free them together without contention between cores.
Pinned DMA buffers
Host memory the GPU and the NVMe controller can reach without a staging copy.
Overlapped transfers
CUDA streams overlap one batch’s read, another’s transfer and a third’s kernel, with events coordinating dependencies.
Mapped index views
view serves immutable indexes in place; beyond memory, nvme residency uses explicit IO instead of page faults.
Allocation-free iterators
StringZilla splits, tokenizes and matches without materializing what it does not keep.
Hardware-assisted waits
UMWAIT, WFET and Zawrs let idle threads wait for memory changes without a futex round-trip.

Fig. 5.1Without the staging copy, the stages overlap

Naive: one batch at a time

10.0

Pipelined: pinned and triple-buffered

≈ 4.4 2.3× sooner
  • NVMe read · io_uring
  • staging memcpy: pinned buffers, no staging copy
  • DMA → VRAM · pinned
  • GPU kernel · stream
Four batches from NVMe to a GPU. Run one after another, every stage waits on the last; with pinned buffers and triple buffering the staging copy disappears and the stages overlap.
06

Verification, six orders of magnitude finer

We test behavior at the scale where it can fail: nanosecond races, numerical drift over long sequences, and connectivity changes in growing graphs. Model checkers, sanitizers, emulators and reference arithmetic each check an invariant end-to-end tests miss.

Mechanisms

Spin models
durability.pml, nvme_ring.pml and nvme_ring_ownership.pml explore every interleaving of the protocols.
GenMC under RC11
Model-checks the real C++ headers under the weak memory model, with deliberately broken knobs that must fail.
TSan, ASan and UBSan
Run thread, address and undefined-behavior sanitizers across the test suites on platforms that support them.
QEMU
SVE at every vector length from 128 to 2048 bits, RVV, and big-endian targets.
118-bit baselines
NumKong checks its kernels against 118-bit references and tracks NVFP4 error over sequence length.
Incremental connectivity
Track isolated clusters as graphs grow, shrink and refine, checking that updates preserve the expected connectivity.

Fig. 6.1A nanosecond race and a second-long timeout need different tests

The resolutions bugs live at, from a nanosecond race between two cores to a second-long request timeout.