vllm.model_executor.model_loader.weight_cache.daemon ¶
Weight cache daemon for fast engine restarts.
One daemon process per GPU holds the post-quantized, TP-sharded weights of its rank in GPU memory and serves CUDA IPC handles to vLLM engines over a Unix domain socket. Restarting engines map the weights via zero-copy IPC instead of reloading from disk.
Launch one daemon per TP rank with a single command:
python -m vllm.model_executor.model_loader.weight_cache.daemon \
--model /path/to/model --tensor-parallel-size 4
Engines then load from the daemons with:
vllm serve /path/to/model --tensor-parallel-size 4 \
--load-format ipc_cache
Only tensor and expert parallelism are supported; pipeline and data parallelism are rejected at launch.
Classes:
-
WeightCacheDaemon–Per-GPU process that loads one TP shard and serves CUDA IPC handles.
Functions:
-
export_entries–Export a model's tensors, preserving tied-parameter aliases.
WeightCacheDaemon ¶
Per-GPU process that loads one TP shard and serves CUDA IPC handles.
Methods:
-
serve_forever–Serve requests until terminated.
Source code in vllm/model_executor/model_loader/weight_cache/daemon.py
101 102 103 104 105 106 107 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 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
_acquire_gpu_lock(socket_path) ¶
Take an exclusive lock guarding this GPU's socket path.
The lock is advisory and released automatically when the daemon exits (or crashes), so a stale socket is only ever removed by whoever owns the lock. A running daemon holding it makes a second daemon fail fast instead of clobbering the live socket.
Source code in vllm/model_executor/model_loader/weight_cache/daemon.py
serve_forever(ready_callback=None) ¶
Serve requests until terminated.
The socket is only bound once the model is fully cached, so clients get a connection error (and fall back to disk) until the daemon is ready.
Parameters:
-
(ready_callback¶Callable[[], None] | None, default:None) –Invoked once the socket is bound and listening, so the launcher can report overall readiness.
Source code in vllm/model_executor/model_loader/weight_cache/daemon.py
_reject_unsupported_parallelism(parallel_config) ¶
Reject parallelism modes other than tensor/expert parallelism.
Source code in vllm/model_executor/model_loader/weight_cache/daemon.py
export_entries(model) ¶
Export a model's tensors, preserving tied-parameter aliases.
named_parameters/named_buffers are iterated with remove_duplicate=False so tied weights (e.g. lm_head.weight sharing storage with embed_tokens.weight) are not silently dropped. Each unique tensor is exported once; every additional name that refers to the same tensor object is recorded in the returned alias map so the client can re-establish the shared identity instead of allocating uninitialized memory for it.
Returns:
-
dict[str, TensorEntry]–A
(entries, aliases)pair whereentriesmaps a canonical name to -
dict[str, str]–its
TensorEntryandaliasesmaps each duplicate name to its -
tuple[dict[str, TensorEntry], dict[str, str]]–canonical name.