Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Male Rivoli's hummingbird in flight
Rivoli's hummingbird, male. Bettina Arrigoni, CC BY 2.0; background removed

rivoli.

Decode LLMs bigger than memory, on one box. Weights stream from NVMe overlapped with compute.

RustHIP / ROCmunified memory systemsNVMe streamingMoE

rivoli is a decode engine for large language models that do not fit in memory. It is designed for ROCm unified memory systems, where the CPU and GPU share one pool of RAM. Whatever does not fit stays on NVMe. In each layer the GPU starts on the experts already in memory while the missing ones stream in, so NVMe reads hide behind compute.

CPUNVMe → RAMGPUattnroutesubmitread misseshitsreapmisseslayer 1attnroutesubmitread misseshitsreapmisseslayer 2time →

In each mixture-of-experts layer:

  1. GPU: attention, then the router’s gate logits.
  2. CPU, route: reads the gate logits and picks the top-k experts for each token (sigmoid, bias, top-k), then merges the picks across tokens.
  3. CPU, submit: looks up each chosen expert in the cache. A hit gets a ticket that is already satisfied. A miss gets a slot and an NVMe read, and a ticket that the read will satisfy.
  4. GPU, hits: runs the resident experts immediately, while the misses stream in.
  5. CPU, reap: collects completed reads and releases their tickets.
  6. GPU, misses: runs the experts that just arrived. Every expert launch waits on its ticket, so there is no “is it resident?” branch.

The overlap is the whole design. A model that fits in memory is not a separate mode. It is the trivial case of the streaming path, where everything happens to be resident.

What makes it different

  • Built for unified memory. rivoli targets ROCm systems where the GPU reads system RAM directly, so there is no separate VRAM copy to manage. When a hardware-specific path is faster, it wins over portability (P3).
  • Bytes per token is the currency. Decode speed is traffic divided by bandwidth. Quantization, residency, prefetch and speculative decode are all ways to cut traffic. Each one’s quality cost is measured, never assumed (P5).
  • The memory knob trades speed, never text. --max-mem changes tok/s and hit rate. It does not change the output (P4).
  • Every claim is a gate that can go red. Each test is shown failing on purpose before its pass counts (Quality gates).

Where to go next

  • The overlap: how streaming, residency and caching fit together.
  • Principles: the seven rules every change is checked against.
  • Architecture: six crates whose dependency graph is the layering.
  • Models: the model families in the tree.
  • Building: toolchain, build and test commands.