Skip to content

vllm.distributed.engram_pool

Read-only tables split by rows over every GPU of a peer group.

The pool owns sharding, rendezvous, transfers and landing buffers; a model owns hashing, row formats and the kernels that read fetched rows. A model: 1. creates get_engram_pool(...)'s tables, loads table.shard, then calls pool.ready(table); 2. per step, calls EngramPrefetch.start(ids) before its layers and wait(i) in layer i; its consume reads fetch.wait(i), or fetch.landed(i) in its own kernel through landed_row.

Transports: nvlink maps each GPU's device or host shard (cuMem FABRIC) and loads rows directly; with rdma, the owners' NICs gather rows from host or HBM shards.

Modules:

  • group –

    Startup rendezvous of every GPU that shares a pool's tables.

  • memory –

    Shard and staging memory: NUMA-local pinned host pages and cuMem HBM.

  • nvlink –

    Peer device or host memory over NVLink: every GPU maps each shard (cuMem FABRIC), so

  • proxy –

    RDMA owner proxy: per GPU, a process whose NIC gathers rows of the shards

  • rdma –

    Table rows from every peer's shard over RDMA, gathered by the owner's NIC.

  • rows –

    How kernels find rows: which GPU owns an id (transports), and where a

  • verbs –

    ctypes bindings to libibverbs: just enough for RC QPs and RDMA WRITEs.

Classes:

  • EngramFetch –

    A started fetch: wait(i) places table i's rows, landed(i) finds them.

  • EngramPool –

    Tables shared by a peer group, and the buffers fetches land in.

  • EngramPrefetch –

    Fetches tables once per step; wait(i) hands table i's rows to

  • EngramTable –

    One table's rows, split evenly over the group's GPUs in rank order.

  • Landed –

    landed_row's view of one table of a fetch.

  • PeerGroup –

    GPUs of several engines that split each table over their memory. They

Functions:

  • get_engram_pool –

    This GPU's pool as EngramConfig's peer_group_* describe it, shared by

  • join_peer_group –

    This GPU's membership, shared by all of its process's tables.

  • landed_row –

    Address of fetched row row of table (args from EngramFetch.landed),

EngramFetch

A started fetch: wait(i) places table i's rows, landed(i) finds them.

Methods:

  • landed –

    Table index's rows where they land, for a kernel that reads them

  • wait –

    Table index's rows; the current stream waits for them.

Attributes:

  • rows (Tensor) –

    Placed rows, [L, ..., K, row_stride] uint8.

rows cached property

Placed rows, [L, ..., K, row_stride] uint8.

landed(index)

Table index's rows where they land, for a kernel that reads them with landed_row instead of wait. Launches nothing.

wait(index)

Table index's rows; the current stream waits for them.

EngramPool

Tables shared by a peer group, and the buffers fetches land in.

Every GPU of the group creates the same pool and tables in the same order (each call is collective). A fetch's rows stay valid until the next starts.

Parameters:

  • group

    (PeerGroup) –

    The peer group splitting the tables.

  • transport

    (str) –

    "nvlink" or "rdma".

  • host_shards

    (bool) –

    Use Grace host memory with NVLink or pinned host memory with RDMA.

  • max_items

    (int) –

    Most rows of one table one fetch gathers on this GPU.

  • max_row_bytes

    (int) –

    Largest row of any table.

  • max_tables

    (int, default: 1 ) –

    Most tables one fetch reads.

  • rdma_inflight

    (int, default: 8 ) –

    Most prefill-sized gathers each NIC keeps in flight (RDMA; 0: no limit), so they delay others' decode fetches little.

  • fetch_mode

    (str, default: 'sync' ) –

    Where EngramPrefetch fetches: "sync" or "async".

  • thp_dir

    (str | None, default: None ) –

    A tmpfs mounted huge=always for host shards, so they get transparent huge pages (RDMA host shards only).

Methods:

  • lookup –

    Rows [L, ..., K, row_stride] (uint8) of ids, as start takes.

  • ready –

    Serve table once every GPU has loaded its shard. Peers read it at

  • start –

    Start fetching ids ([..., L, K]: rows of table l at [..., l, :])

  • table –

    Create a table of num_rows rows of row_bytes bytes. Collective;

_check_same(identity)

Fail startup on every GPU unless all of them passed identity.

_output(numel)

Placed rows, allocated once a fetch places any.

lookup(tables, ids)

Rows [L, ..., K, row_stride] (uint8) of ids, as start takes.

ready(table)

Serve table once every GPU has loaded its shard. Peers read it at any time from then on, so it cannot be reloaded.

start(tables, ids)

Start fetching ids ([..., L, K]: rows of table l at [..., l, :]) on the current stream; ids < 0 or past a table give zero rows.

table(num_rows, row_bytes, name='')

Create a table of num_rows rows of row_bytes bytes. Collective; name identifies it across the group.

EngramPrefetch

Fetches tables once per step; wait(i) hands table i's rows to consume(fetch, i) there, or after the fetch on a side stream (async).

Methods:

  • start –

    Start fetching ids ([..., L, K]) before the layers run.

  • wait –

    Make table index's rows consumed before the current stream goes on.

start(ids)

Start fetching ids ([..., L, K]) before the layers run.

wait(index)

Make table index's rows consumed before the current stream goes on.

EngramTable dataclass

One table's rows, split evenly over the group's GPUs in rank order. shard is this GPU's rows from row_start (host memory for host shards).

Landed

Bases: NamedTuple

landed_row's view of one table of a fetch.

PeerGroup

GPUs of several engines that split each table over their memory. They meet only at startup (a file store), making the same exchanges in order.

Methods:

  • all_gather –

    Every GPU's value, in rank order. Collective.

  • startup_stage –

    Report rank-local failures before any peer enters the next collective.

all_gather(value)

Every GPU's value, in rank order. Collective.

startup_stage(operation)

Report rank-local failures before any peer enters the next collective.

get_engram_pool(max_items, max_row_bytes, max_tables=1) cached

This GPU's pool as EngramConfig's peer_group_* describe it, shared by every table of the process that fits these sizes.

join_peer_group(size, path) cached

This GPU's membership, shared by all of its process's tables.

landed_row(rows, slots, ready, table, row, valid, ROW_STRIDE, PLACED)

Address of fetched row row of table (args from EngramFetch.landed), and whether it holds data (else load zeros). Call from every program.