Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/v1/worker/test_ple_offload_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,12 @@ def test_offload_distributed_sets_config_only_for_model_parallel(

# The Offload subprocess may inherit DP environment variables from a GPU
# worker, but its isolated model-parallel world must always remain DP1.
monkeypatch.setattr(envs, "VLLM_DP_SIZE", 2)
monkeypatch.setattr(envs, "VLLM_DP_RANK", 1)
monkeypatch.setattr(envs, "VLLM_DP_RANK_LOCAL", 1)
# Through the environment, not as envs attributes: VLLM_DP_RANK_LOCAL
# defaults to VLLM_DP_RANK, so restoring it as an attribute would leave
# local DP rank 1 behind for the rest of the process.
set_lazy_env(monkeypatch, "VLLM_DP_SIZE", "2")
set_lazy_env(monkeypatch, "VLLM_DP_RANK", "1")
set_lazy_env(monkeypatch, "VLLM_DP_RANK_LOCAL", "1")

monkeypatch.setattr(
ple_offload_worker.dist,
Expand Down
14 changes: 9 additions & 5 deletions vllm/v1/ple_offload/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from cuda.bindings import driver as cuda_driver

import vllm.envs as envs
from vllm.config import VllmConfig, set_current_vllm_config
from vllm.config import ParallelConfig, VllmConfig, set_current_vllm_config
from vllm.distributed.parallel_state import (
ensure_model_parallel_initialized,
init_distributed_environment,
Expand Down Expand Up @@ -369,10 +369,13 @@ def _init_offload_distributed() -> None:
# initialize_model_parallel reads the active VllmConfig in the current
# vLLM version. Explicitly configure DP1/TP1/PP1 to match the isolated
# world, regardless of any DP environment variables inherited from the GPU
# worker. The real DP/TP configuration is used later for model construction,
# registration, and request routing.
offload_config = VllmConfig()
offload_parallel_config = offload_config.parallel_config
# worker. ParallelConfig takes those variables at construction and
# VllmConfig.__post_init__ derives the participating devices from them, so
# the parallel config is reduced to DP1 before the VllmConfig is built: a DP
# rank that sees only its own GPU would otherwise look up the device at its
# inherited local DP rank. The real DP/TP configuration is used later for
# model construction, registration, and request routing.
offload_parallel_config = ParallelConfig()
offload_parallel_config.data_parallel_size = 1
offload_parallel_config.data_parallel_size_local = 1
offload_parallel_config.data_parallel_rank = 0
Expand All @@ -385,6 +388,7 @@ def _init_offload_distributed() -> None:
offload_parallel_config.world_size = 1
offload_parallel_config.nnodes = 1
offload_parallel_config.node_rank = 0
offload_config = VllmConfig(parallel_config=offload_parallel_config)
with set_current_vllm_config(offload_config):
ensure_model_parallel_initialized(
tensor_model_parallel_size=1,
Expand Down
Loading