[Misc] Improve comment for DPEngineCoreActor._set_cuda_visible_devices() (#21501)

Signed-off-by: Rui Qiao <ruisearch42@gmail.com>
This commit is contained in:
Rui Qiao 2025-07-24 03:13:40 -07:00 committed by GitHub
parent 6eca337ce0
commit 73e3949d07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,