From 73e3949d07cb11f0f9ebfb85cf0ee39d29db6be4 Mon Sep 17 00:00:00 2001 From: Rui Qiao <161574667+ruisearch42@users.noreply.github.com> Date: Thu, 24 Jul 2025 03:13:40 -0700 Subject: [PATCH] [Misc] Improve comment for DPEngineCoreActor._set_cuda_visible_devices() (#21501) Signed-off-by: Rui Qiao --- vllm/v1/engine/core.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vllm/v1/engine/core.py b/vllm/v1/engine/core.py index 7779b559c20e..5b8b95e932e1 100644 --- a/vllm/v1/engine/core.py +++ b/vllm/v1/engine/core.py @@ -1082,8 +1082,13 @@ class DPEngineCoreActor(DPEngineCoreProc): # RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES, but vLLM workers created # thereafter would have CUDA_VISIBLE_DEVICES set, which is sticky: # https://github.com/ray-project/ray/blob/e752fc319ddedd9779a0989b6d3613909bad75c9/python/ray/_private/worker.py#L456 # noqa: E501 - # But vLLM worker assumes visibility into all local GPUs, therefore - # this results in incorrect indexing into the GPU ID list. + # This is problematic because when the vLLM worker (a Ray actor) + # executes a task, it indexes into the sticky CUDA_VISIBLE_DEVICES + # rather than directly using the GPU ID, potentially resulting in + # index out of bounds error. See: + # https://github.com/ray-project/ray/pull/40461/files#diff-31e8159767361e4bc259b6d9883d9c0d5e5db780fcea4a52ead4ee3ee4a59a78R1860 # noqa: E501 + # and get_accelerator_ids_for_accelerator_resource() in worker.py + # of ray. self._set_cuda_visible_devices(vllm_config, local_dp_rank) super().__init__(vllm_config, local_client, "", executor_class,