Skip to content

vllm.v1.executor.vllm_net_devices

GPU-to-NIC net-device mapping for RDMA transports (UCX, NVSHMEM, ...).

Shared by both UniProcExecutor (TP=1) and MultiprocExecutor (TP>1). All transport-specific env vars and sysfs lookups live here so executor files only need to call set_worker_net_device(local_rank, vllm_config).

Requires two env vars set together: - VLLM_GPU_NIC_PCIE_MAPPING -- comma-separated GPU_BDF=NIC_BDF pairs. - VLLM_NIC_SELECTION_VARS -- comma-separated list of env vars to set, each optionally suffixed (e.g. UCX_NET_DEVICES:1,NCCL_IB_HCA:1).

Functions:

normalize_pci(addr)

Parse PCI BDF/domain-bus-device-function into comparable ints (all hex).

Supported shapes: - domain:bus:dev.fn -- domain width varies (e.g. 00000001:00:00.0, 0001:00:00.0, 0000:3f:00.0). - bus:dev.fn -- domain 0 (e.g. 01:00.0, 40:00.0).

Function suffix is hex (typically 0--7). Raises ValueError if malformed.

parse_nic_selection_vars(raw)

Parse VLLM_NIC_SELECTION_VARS into (env_var_name, suffix) pairs.

Each entry is VAR_NAME or VAR_NAME:<suffix>. The colon and everything after it is appended verbatim to the RDMA device name.

rdma_name_for_nic_pci(nic_pci)

Map NIC PCI BDF to sysfs RDMA name (mlx5_, ibp, ...).

Under /sys/class/infiniband/<name>/, device is a symlink to the PCI device directory (e.g. .../0101:00:00.0). We take Path(...).resolve().name as the BDF string.

VLLM_GPU_NIC_PCIE_MAPPING NIC keys must normalize (via normalize_pci) to the same tuple as this basename.

set_worker_gpu_nic_mapping(local_rank)

Set NIC selection env vars from VLLM_GPU_NIC_PCIE_MAPPING for a worker.

Which env vars are set is controlled by VLLM_NIC_SELECTION_VARS.

set_worker_net_device(local_rank, vllm_config)

Top-level entry point for both UniProcExecutor and MultiprocExecutor.

Sets NIC selection env vars from VLLM_GPU_NIC_PCIE_MAPPING and VLLM_NIC_SELECTION_VARS if present; no-op otherwise.