vllm.distributed.weight_transfer.ipc_engine ¶
IPC-based weight transfer engine using CUDA IPC for communication.
Classes:
-
IPCTrainerInitInfo–Trainer-side init info for IPC weight transfer. No rendezvous needed;
-
IPCTrainerWeightTransferEngine–Trainer-side CUDA IPC weight transfer engine.
-
IPCWeightTransferEngine–Weight transfer engine using CUDA IPC for communication between trainer and workers.
-
IPCWeightTransferInitInfo–Worker-side init info for IPC weight transfer. No rendezvous needed.
-
IPCWeightTransferUpdateInfo–Per-round update info for the IPC weight transfer backend.
IPCTrainerInitInfo dataclass ¶
Bases: TrainerInitInfo
Trainer-side init info for IPC weight transfer. No rendezvous needed; rank (from TrainerInitInfo) identifies this trainer process — rank 0 ships the merged IPC handles. All ranks still join the handle all-gather.
packed / packed_buffer_size_bytes are the transfer's wire params. The trainer propagates packed to the worker at trainer_init so the two sides cannot disagree. backend is the factory dispatch key.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
IPCTrainerWeightTransferEngine ¶
Bases: TrainerWeightTransferEngine[IPCTrainerInitInfo]
Trainer-side CUDA IPC weight transfer engine.
Called on every trainer rank. For multi-rank (e.g. FSDP) trainers all ranks iterate the source (materializing each tensor) and contribute to the IPC-handle all-gather; only the sender (rank 0) ships the merged handles to the inference side. IPC transfer is straight-line (no concurrent broadcast like NCCL): update_weights is the transfer, and it rides the client, so it no-ops on non-senders.
packed / packed_buffer_size_bytes come from IPCTrainerInitInfo; the sender propagates packed to the worker at trainer_init.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
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 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
_all_gather_and_merge_handles(handles) ¶
All-gather and merge IPC handle dicts across ranks in one call.
Each rank contributes a list of {gpu_uuid: ipc_args} dicts (one per parameter or one per chunk). A single all_gather_object collects every rank's full list, then the sender merges per-index so each dict maps every GPU UUID to its args.
The all-gather runs over the default process group; this assumes the default group is exactly the set of colocated trainer ranks and that the sender is a member. No-op (returns handles unchanged) when no distributed group exists.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
_do_send(names, dtype_names, shapes, ipc_handles, tensor_sizes=None) ¶
Build one update payload and ship it via the client. Only the sender ships (non-sender ranks already contributed to the handle all-gather).
Emits raw ipc_handles; transports that cannot carry them natively (HTTP/JSON) pickle them in their client (see HTTPVLLMWeightSyncClient).
Source code in vllm/distributed/weight_transfer/ipc_engine.py
_post_send_sync() staticmethod ¶
Barrier + ipc_collect after a send; no-op if single-GPU.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
_send_packed(source) ¶
Send weights in bounded-memory chunks (packed mode).
Source code in vllm/distributed/weight_transfer/ipc_engine.py
_send_unpacked(source) ¶
Iterate the source, build one IPC handle per param, all-gather the handles across ranks, and (sender) ship them in one update call.
Returns the strong refs to every contiguous copy. reduce_tensor's args do NOT keep storage alive, and non-contiguous inputs allocate fresh storage in .contiguous(); the caller must keep these alive until the post-send barrier (past finish) so the consumer's IPC views stay valid.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
IPCWeightTransferEngine ¶
Bases: WeightTransferEngine[IPCWeightTransferInitInfo, IPCWeightTransferUpdateInfo]
Weight transfer engine using CUDA IPC for communication between trainer and workers.
This implementation uses CUDA IPC to transfer weights from the trainer (rank 0) to all inference workers in a process group. IPC handles are used to share memory between processes on the same node.
Methods:
-
finish_weight_update–Finalize layerwise reloading after all weights have been received.
-
init_transfer_engine–Initialize the weight transfer mechanism. No data-plane rendezvous is
-
receive_weights–Receive weights from the trainer via CUDA IPC handles and load them.
-
start_weight_update–Initialize layerwise reloading for the incoming checkpoint weights.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
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 | |
finish_weight_update() ¶
Finalize layerwise reloading after all weights have been received.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
init_transfer_engine(init_info) ¶
Initialize the weight transfer mechanism. No data-plane rendezvous is needed for IPC; this just records the trainer-supplied wire params so the worker decodes exactly as the trainer encoded.
Parameters:
-
(init_info¶IPCWeightTransferInitInfo) –IPC initialization info (carries
packed).
Source code in vllm/distributed/weight_transfer/ipc_engine.py
receive_weights(update_info) ¶
Receive weights from the trainer via CUDA IPC handles and load them.
Whether the transfer is packed is read from self.packed, set at the init handshake from the trainer's init info, so it is guaranteed to match how the trainer encoded.
Parameters:
-
(update_info¶IPCWeightTransferUpdateInfo) –IPC update info containing parameter names, dtypes, shapes, and IPC handles. Each IPC handle is a mapping between physical GPU UUID and the rebuild_cuda_tensor args tuple.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
start_weight_update() ¶
Initialize layerwise reloading for the incoming checkpoint weights.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
IPCWeightTransferInitInfo dataclass ¶
Bases: WeightTransferInitInfo
Worker-side init info for IPC weight transfer. No rendezvous needed.
packed is a must-agree wire param: the trainer ships it here at the init handshake so the worker decodes with the same setting the trainer encoded with. The consumer rebuilds from the IPC handle + tensor_sizes, so it does not need the buffer size (producer-only).
Source code in vllm/distributed/weight_transfer/ipc_engine.py
IPCWeightTransferUpdateInfo dataclass ¶
Bases: WeightTransferUpdateInfo
Per-round update info for the IPC weight transfer backend.
Attributes:
-
ipc_handles(list[dict[str, tuple]] | dict[str, tuple] | None) –IPC handles mapping physical GPU UUID to rebuild_cuda_tensor args.
-
ipc_handles_pickled(str | None) –Base64-encoded pickled IPC handles, used for HTTP transport.
-
tensor_sizes(list[int] | None) –Per-parameter sizes in bytes within the packed buffer.
Source code in vllm/distributed/weight_transfer/ipc_engine.py
ipc_handles = None class-attribute instance-attribute ¶
IPC handles mapping physical GPU UUID to rebuild_cuda_tensor args. For non-packed mode: list of per-parameter handle dicts. For packed mode: single handle dict for the packed buffer.
ipc_handles_pickled = None class-attribute instance-attribute ¶
Base64-encoded pickled IPC handles, used for HTTP transport.
tensor_sizes = None class-attribute instance-attribute ¶
Per-parameter sizes in bytes within the packed buffer. Required when packed=True, unused otherwise.