[Rebase] Rebase to vllm releases/v0.22.0 (#3891)

Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
Signed-off-by: ZhengWG <zwg0606@gmail.com>
Signed-off-by: david6666666 <530634352@qq.com>
Signed-off-by: Yueqian Lin <linyueqian@outlook.com>
Signed-off-by: nainiu258 <cperfect02@163.com>
Signed-off-by: nainiu258 <101917677+nainiu258@users.noreply.github.com>
Signed-off-by: JasonJ2021 <jasonj@zju.edu.cn>
Signed-off-by: Zhou Taichang <tzhouam@connect.ust.hk>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: skf <54565339+skf-1999@users.noreply.github.com>
Co-authored-by: Zheng Wengang <zwg0606@gmail.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com>
Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
Co-authored-by: nainiu258 <101917677+nainiu258@users.noreply.github.com>
Co-authored-by: Jason <72191212+JasonJ2021@users.noreply.github.com>
Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com>
This commit is contained in:
62 files changed
+998 -354

No files matched your search

+88 -1
View File
@@ -4,7 +4,7 @@ import sys
import pytest
from pytest_mock import MockerFixture
from vllm_omni.entrypoints.stage_utils import set_stage_devices
from vllm_omni.entrypoints.stage_utils import _map_device_list, set_stage_devices
def _make_dummy_torch(call_log):
@@ -130,3 +130,90 @@ def test_set_stage_devices_npu_platform(mocker: MockerFixture, monkeypatch: pyte
set_stage_devices(stage_id=0, devices="0,1")
assert os.environ["ASCEND_RT_VISIBLE_DEVICES"] == "4,5"
# ---- _map_device_list unit tests ----
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_idempotency():
"""Device IDs already in the visible set are returned as-is (idempotency)."""
result = _map_device_list(0, ["0", "1"], ["0", "1", "2", "3"])
assert result == ["0", "1"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_idempotency_single():
"""Single device ID in visible set passes through."""
result = _map_device_list(1, ["1"], ["0", "1"])
assert result == ["1"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_index_mapping():
"""Device IDs < num_visible not in set are treated as indices."""
result = _map_device_list(0, ["0", "1"], ["6", "7", "8", "9"])
assert result == ["6", "7"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_physical_fallback():
"""Device IDs >= num_visible are treated as physical IDs and passed through."""
result = _map_device_list(1, ["2"], ["0", "1"])
assert result == ["2"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_physical_fallback_multi():
"""Multiple device IDs >= num_visible all pass through as physical IDs."""
result = _map_device_list(1, ["2", "3"], ["0", "1"])
assert result == ["2", "3"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_physical_fallback_mixed():
"""When some devices are >= num_visible but some < num_visible, index mapping applies for the subset."""
# "1" < num_visible(2) so index mapping applies: visible[1] = "5"
# "2" >= num_visible(2) so it's dropped via the partial mapping path
result = _map_device_list(1, ["1", "2"], ["0", "5"])
assert result == ["5"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_index_with_gaps():
"""Index-based mapping works with non-contiguous visible device lists."""
result = _map_device_list(0, ["0", "1"], ["4", "5", "7"])
assert result == ["4", "5"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_index_mapping_no_idempotency():
"""Device IDs < num_visible not in visible set map via index even when no ID matches literally."""
# "0","1" with visible ["2","3"]: idempotency check fails (none in set),
# but index mapping succeeds: visible[0]="2", visible[1]="3"
result = _map_device_list(0, ["0", "1"], ["2", "3"])
assert result == ["2", "3"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_partial_mapping():
"""When only a subset can map, returns the mapped subset (no error)."""
result = _map_device_list(0, ["0", "1", "2"], ["5", "6"])
assert result == ["5", "6"]
@pytest.mark.core_model
@pytest.mark.cpu
def test_map_device_list_raises_on_non_numeric():
"""Non-numeric device IDs raise ValueError."""
with pytest.raises(ValueError, match="must be non-negative integers"):
_map_device_list(0, ["a"], ["0", "1"])