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 every GPU's HBM 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 HBM over NVLink: every GPU maps every shard (cuMem FABRIC handles), 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
tablesonce 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
rowoftable(args fromEngramFetch.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:
Source code in vllm/distributed/engram_pool/__init__.py
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.
Source code in vllm/distributed/engram_pool/__init__.py
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) –Keep shards in host memory (RDMA only).
-
(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
EngramPrefetchfetches: "sync" or "async". -
(thp_dir¶str | None, default:None) –A tmpfs mounted
huge=alwaysfor host shards, so they get transparent huge pages (RDMA host shards only).
Methods:
-
lookup–Rows
[L, ..., K, row_stride](uint8) ofids, asstarttakes. -
ready–Serve
tableonce 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_rowsrows ofrow_bytesbytes. Collective;
Source code in vllm/distributed/engram_pool/__init__.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
_check_same(identity)
¶
Fail startup on every GPU unless all of them passed identity.
Source code in vllm/distributed/engram_pool/__init__.py
_output(numel)
¶
Placed rows, allocated once a fetch places any.
Source code in vllm/distributed/engram_pool/__init__.py
lookup(tables, ids)
¶
Rows [L, ..., K, row_stride] (uint8) of ids, as start takes.
Source code in vllm/distributed/engram_pool/__init__.py
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.
Source code in vllm/distributed/engram_pool/__init__.py
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.
Source code in vllm/distributed/engram_pool/__init__.py
table(num_rows, row_bytes, name='')
¶
Create a table of num_rows rows of row_bytes bytes. Collective;
name identifies it across the group.
Source code in vllm/distributed/engram_pool/__init__.py
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.
Source code in vllm/distributed/engram_pool/__init__.py
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).
Source code in vllm/distributed/engram_pool/__init__.py
Landed
¶
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.
Source code in vllm/distributed/engram_pool/group.py
all_gather(value)
¶
Every GPU's value, in rank order. Collective.
Source code in vllm/distributed/engram_pool/group.py
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.
Source code in vllm/distributed/engram_pool/__init__.py
join_peer_group(size, path)
cached
¶
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.