# xpu-io/tutti architecture

> Architecture diagram of the GitHub repository xpu-io/tutti, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xpu-io/tutti
- Repository: https://github.com/xpu-io/tutti

## Overview

Tutti is a GPU-centric, NVMe-backed KV-cache object store with a C++ storage runtime and a Python KV-cache engine/vLLM integration. The principal workflow is: vLLM requests layer-wise cache loads or saves; the worker coordinates staging and the engine; chunk indexing and the NVMe store plan and submit I/O through the native runtime; registered data paths move data between GPU memory and storage. The graph also shows native configuration, resolution, striped I/O, and device management. Some links are documented in the README or SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`tutti/engine/core.py`](https://github.com/xpu-io/tutti/blob/main/tutti/engine/core.py) (KV Engine), [`csrc/data_paths/local_nvme/local_nvme_data_path.cpp`](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/local_nvme_data_path.cpp) (Local NVMe Path), [`tutti/integration/vllm/worker.py`](https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/worker.py) (Layer Worker), [`tutti/storage/tutti_nvme/store.py`](https://github.com/xpu-io/tutti/blob/main/tutti/storage/tutti_nvme/store.py) (NVMe KV Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["vLLM Integration"]
  node_worker["Layer Worker<br/>[worker.py]"]
  node_worker_meta["Worker Metadata<br/>[worker_meta.py]"]
  node_connector["vLLM Connector<br/>[connector.py]"]
end

subgraph group_python["KV Engine"]
  node_engine["KV Engine<br/>[core.py]"]
  node_staging["GPU Staging<br/>[staging.py]"]
  node_transfer["KV Transfer<br/>[transfer.py]"]
  node_chunk_index["Chunk Index<br/>[chunk_index.py]"]
  node_nvme_store["NVMe KV Store<br/>[store.py]"]
  node_object_layout["Object Layout<br/>[object_layout.py]"]
end

subgraph group_native["Native Runtime"]
  node_runtime_api["Storage Runtime API<br/>[storage_runtime.h]"]
  node_runtime_create["Runtime Assembly"]
  node_resolver["File Resolver<br/>[resolver.h]"]
  node_payload["Resolved Payload<br/>[payload.h]"]
  node_data_factory["Data Path Factory"]
end

subgraph group_io["GPU Data Paths"]
  node_local_path["Local NVMe Path"]
  node_striped_path["Striped NVMe Path"]
  node_prp_builder["PRP Builder<br/>[prp_builder.h]"]
  node_metadata_cache["PRP Caches<br/>[prp_page_cache.h]"]
end

subgraph group_device["NVMe Management"]
  node_nvmeservice["NVMe Service"]
  node_mount_manager["Mount Manager<br/>[mount_manager.cpp]"]
  node_libnvm["GPU NVMe Client<br/>[ctrl.cpp]"]
  node_snvme["snvme Kernel<br/>[snvm_control.c]"]
end

node_vllm(("vLLM"))
node_nvme[("NVMe SSDs")]
node_gpu[("GPU HBM")]

node_vllm -->|"calls"| node_connector
node_connector -.->|"dispatches layers"| node_worker
node_worker -->|"orchestrates"| node_engine
node_worker -->|"allocates staging"| node_staging
node_worker -->|"publishes results"| node_worker_meta
node_engine -->|"uses"| node_staging
node_engine -->|"selects transfer"| node_transfer
node_engine -->|"indexes chunks"| node_chunk_index
node_engine -->|"uses store"| node_nvme_store
node_nvme_store -->|"maps objects"| node_object_layout
node_nvme_store -->|"submits I/O"| node_runtime_api
node_runtime_api -.->|"implemented by"| node_runtime_create
node_runtime_create -->|"configures resolver"| node_resolver
node_runtime_create -->|"creates path"| node_data_factory
node_resolver -->|"produces target"| node_payload
node_data_factory -.->|"selects local"| node_local_path
node_data_factory -.->|"selects striped"| node_striped_path
node_local_path -->|"builds PRPs"| node_prp_builder
node_local_path -->|"uses caches"| node_metadata_cache
node_local_path -.->|"drives NVMe"| node_libnvm
node_striped_path -.->|"writes striped data"| node_nvme
node_nvmeservice -.->|"manages mounts"| node_mount_manager
node_mount_manager -->|"mounts devices"| node_nvme
node_nvmeservice -.->|"leases queues"| node_snvme
node_libnvm -.->|"uses queues"| node_snvme
node_libnvm -.->|"issues I/O"| node_nvme
node_local_path -.->|"transfers data"| node_gpu
node_gpu -->|"P2P DMA"| node_nvme

click node_worker "https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/worker.py"
click node_worker_meta "https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/worker_meta.py"
click node_connector "https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/connector.py"
click node_engine "https://github.com/xpu-io/tutti/blob/main/tutti/engine/core.py"
click node_staging "https://github.com/xpu-io/tutti/blob/main/tutti/engine/staging.py"
click node_transfer "https://github.com/xpu-io/tutti/blob/main/tutti/engine/transfer.py"
click node_chunk_index "https://github.com/xpu-io/tutti/blob/main/tutti/index/chunk_index.py"
click node_nvme_store "https://github.com/xpu-io/tutti/blob/main/tutti/storage/tutti_nvme/store.py"
click node_object_layout "https://github.com/xpu-io/tutti/blob/main/tutti/storage/tutti_nvme/object_layout.py"
click node_runtime_api "https://github.com/xpu-io/tutti/blob/main/csrc/include/tutti/storage_runtime.h"
click node_runtime_create "https://github.com/xpu-io/tutti/blob/main/csrc/tutti_runtime/tutti_runtime_create.cpp"
click node_resolver "https://github.com/xpu-io/tutti/blob/main/csrc/resolvers/local_file/resolver.h"
click node_payload "https://github.com/xpu-io/tutti/blob/main/csrc/payloads/ext4_local_nvme/payload.h"
click node_data_factory "https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/data_path_factory.cpp"
click node_local_path "https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/local_nvme_data_path.cpp"
click node_striped_path "https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/striped_local_nvme/striped_data_path.cpp"
click node_prp_builder "https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/io/prp_builder.h"
click node_metadata_cache "https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/metadata/prp_page_cache.h"
click node_nvmeservice "https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/nvmeservice/src/nvmeservice_state.cpp"
click node_mount_manager "https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/nvmeservice/src/mount_manager.cpp"
click node_libnvm "https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/libnvm/src/ctrl.cpp"
click node_snvme "https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/kernel_modules/snvme/snvm_control.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_worker,node_worker_meta,node_connector toneBlue
class node_engine,node_staging,node_transfer,node_chunk_index,node_nvme_store,node_object_layout,node_nvme,node_gpu toneAmber
class node_runtime_api,node_runtime_create,node_resolver,node_payload,node_data_factory toneMint
class node_local_path,node_striped_path,node_prp_builder,node_metadata_cache toneRose
class node_nvmeservice,node_mount_manager,node_libnvm,node_snvme,node_vllm toneIndigo
```

## Components

### vLLM Integration

- [Layer Worker](https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/worker.py): `tutti/integration/vllm/worker.py`
- [Worker Metadata](https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/worker_meta.py): `tutti/integration/vllm/worker_meta.py`
- [vLLM Connector](https://github.com/xpu-io/tutti/blob/main/tutti/integration/vllm/connector.py): `tutti/integration/vllm/connector.py`

### KV Engine

- [KV Engine](https://github.com/xpu-io/tutti/blob/main/tutti/engine/core.py): `tutti/engine/core.py`
- [GPU Staging](https://github.com/xpu-io/tutti/blob/main/tutti/engine/staging.py): `tutti/engine/staging.py`
- [KV Transfer](https://github.com/xpu-io/tutti/blob/main/tutti/engine/transfer.py): `tutti/engine/transfer.py`
- [Chunk Index](https://github.com/xpu-io/tutti/blob/main/tutti/index/chunk_index.py): `tutti/index/chunk_index.py`
- [NVMe KV Store](https://github.com/xpu-io/tutti/blob/main/tutti/storage/tutti_nvme/store.py): `tutti/storage/tutti_nvme/store.py`
- [Object Layout](https://github.com/xpu-io/tutti/blob/main/tutti/storage/tutti_nvme/object_layout.py): `tutti/storage/tutti_nvme/object_layout.py`

### Native Runtime

- [Storage Runtime API](https://github.com/xpu-io/tutti/blob/main/csrc/include/tutti/storage_runtime.h): `csrc/include/tutti/storage_runtime.h`
- [Runtime Assembly](https://github.com/xpu-io/tutti/blob/main/csrc/tutti_runtime/tutti_runtime_create.cpp): `csrc/tutti_runtime/tutti_runtime_create.cpp`
- [File Resolver](https://github.com/xpu-io/tutti/blob/main/csrc/resolvers/local_file/resolver.h): `csrc/resolvers/local_file/resolver.h`
- [Resolved Payload](https://github.com/xpu-io/tutti/blob/main/csrc/payloads/ext4_local_nvme/payload.h): `csrc/payloads/ext4_local_nvme/payload.h`
- [Data Path Factory](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/data_path_factory.cpp): `csrc/data_paths/data_path_factory.cpp`

### GPU Data Paths

- [Local NVMe Path](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/local_nvme_data_path.cpp): `csrc/data_paths/local_nvme/local_nvme_data_path.cpp`
- [Striped NVMe Path](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/striped_local_nvme/striped_data_path.cpp): `csrc/data_paths/striped_local_nvme/striped_data_path.cpp`
- [PRP Builder](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/io/prp_builder.h): `csrc/data_paths/local_nvme/io/prp_builder.h`
- [PRP Caches](https://github.com/xpu-io/tutti/blob/main/csrc/data_paths/local_nvme/metadata/prp_page_cache.h): `csrc/data_paths/local_nvme/metadata/prp_page_cache.h`

### NVMe Management

- [NVMe Service](https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/nvmeservice/src/nvmeservice_state.cpp): `csrc/device_manager/nvme/nvmeservice/src/nvmeservice_state.cpp`
- [Mount Manager](https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/nvmeservice/src/mount_manager.cpp): `csrc/device_manager/nvme/nvmeservice/src/mount_manager.cpp`
- [GPU NVMe Client](https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/libnvm/src/ctrl.cpp): `csrc/device_manager/nvme/libnvm/src/ctrl.cpp`
- [snvme Kernel](https://github.com/xpu-io/tutti/blob/main/csrc/device_manager/nvme/kernel_modules/snvme/snvm_control.c): `csrc/device_manager/nvme/kernel_modules/snvme/snvm_control.c`

### Other components

- **vLLM**
- **NVMe SSDs**
- **GPU HBM**

## Connections

- vLLM → vLLM Connector: calls
- vLLM Connector → Layer Worker: dispatches layers
- Layer Worker → KV Engine: orchestrates (evidence: `tutti/integration/vllm/worker.py`)
- Layer Worker → GPU Staging: allocates staging (evidence: `tutti/integration/vllm/worker.py`)
- Layer Worker → Worker Metadata: publishes results (evidence: `tutti/integration/vllm/worker.py`)
- KV Engine → GPU Staging: uses (evidence: `tutti/engine/core.py`)
- KV Engine → KV Transfer: selects transfer (evidence: `tutti/engine/core.py`)
- KV Engine → Chunk Index: indexes chunks (evidence: `tutti/engine/core.py`)
- KV Engine → NVMe KV Store: uses store (evidence: `tutti/engine/core.py`)
- NVMe KV Store → Object Layout: maps objects (evidence: `tutti/storage/tutti_nvme/store.py`)
- NVMe KV Store → Storage Runtime API: submits I/O (evidence: `tutti/storage/tutti_nvme/store.py`)
- Storage Runtime API → Runtime Assembly: implemented by
- Runtime Assembly → File Resolver: configures resolver (evidence: `csrc/tutti_runtime/tutti_runtime_create.cpp`)
- Runtime Assembly → Data Path Factory: creates path (evidence: `csrc/tutti_runtime/tutti_runtime_create.cpp`)
- File Resolver → Resolved Payload: produces target (evidence: `csrc/payloads/ext4_local_nvme/payload.h`)
- Data Path Factory → Local NVMe Path: selects local
- Data Path Factory → Striped NVMe Path: selects striped
- Local NVMe Path → PRP Builder: builds PRPs (evidence: `csrc/data_paths/local_nvme/local_nvme_data_path.cpp`)
- Local NVMe Path → PRP Caches: uses caches
- Local NVMe Path → GPU NVMe Client: drives NVMe
- Striped NVMe Path → NVMe SSDs: writes striped data
- NVMe Service → Mount Manager: manages mounts
- Mount Manager → NVMe SSDs: mounts devices (evidence: `csrc/device_manager/nvme/nvmeservice/src/mount_manager.cpp`)
- NVMe Service → snvme Kernel: leases queues
- GPU NVMe Client → snvme Kernel: uses queues
- GPU NVMe Client → NVMe SSDs: issues I/O
- Local NVMe Path → GPU HBM: transfers data
- GPU HBM → NVMe SSDs: P2P DMA
