1
1
# SPDX-License-Identifier: Apache-2.0
2
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-
4
3
import logging
5
4
import traceback
6
5
from itertools import chain
7
6
from typing import TYPE_CHECKING , Optional
8
7
8
+ from vllm import envs
9
9
from vllm .plugins import load_plugins_by_group
10
10
from vllm .utils import resolve_obj_by_qualname , supports_xccl
11
11
@@ -31,20 +31,26 @@ def vllm_version_matches_substr(substr: str) -> bool:
31
31
32
32
33
33
def tpu_platform_plugin () -> Optional [str ]:
34
- is_tpu = False
35
34
logger .debug ("Checking if TPU platform is available." )
35
+
36
+ # Check for Pathways TPU proxy
37
+ if envs .VLLM_TPU_USING_PATHWAYS :
38
+ logger .debug ("Confirmed TPU platform is available via Pathways proxy." )
39
+ return "tpu_commons.platforms.tpu_jax.TpuPlatform"
40
+
41
+ # Check for libtpu installation
36
42
try :
37
43
# While it's technically possible to install libtpu on a
38
44
# non-TPU machine, this is a very uncommon scenario. Therefore,
39
- # we assume that libtpu is installed if and only if the machine
45
+ # we assume that libtpu is installed only if the machine
40
46
# has TPUs.
47
+
41
48
import libtpu # noqa: F401
42
- is_tpu = True
43
49
logger .debug ("Confirmed TPU platform is available." )
50
+ return "vllm.platforms.tpu.TpuPlatform"
44
51
except Exception as e :
45
52
logger .debug ("TPU platform is not available because: %s" , str (e ))
46
-
47
- return "vllm.platforms.tpu.TpuPlatform" if is_tpu else None
53
+ return None
48
54
49
55
50
56
def cuda_platform_plugin () -> Optional [str ]:
0 commit comments