Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
9d827170
Unverified
Commit
9d827170
authored
Nov 21, 2024
by
Mengqing Cao
Committed by
GitHub
Nov 21, 2024
Browse files
[Platforms] Add `device_type` in `Platform` (#10508)
Signed-off-by:
MengqingCao
<
cmq0113@163.com
>
parent
6c1208d0
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
11 additions
and
15 deletions
+11
-15
vllm/config.py
vllm/config.py
+2
-15
vllm/platforms/cpu.py
vllm/platforms/cpu.py
+1
-0
vllm/platforms/cuda.py
vllm/platforms/cuda.py
+1
-0
vllm/platforms/hpu.py
vllm/platforms/hpu.py
+1
-0
vllm/platforms/interface.py
vllm/platforms/interface.py
+1
-0
vllm/platforms/neuron.py
vllm/platforms/neuron.py
+1
-0
vllm/platforms/openvino.py
vllm/platforms/openvino.py
+1
-0
vllm/platforms/rocm.py
vllm/platforms/rocm.py
+1
-0
vllm/platforms/tpu.py
vllm/platforms/tpu.py
+1
-0
vllm/platforms/xpu.py
vllm/platforms/xpu.py
+1
-0
No files found.
vllm/config.py
View file @
9d827170
...
...
@@ -1193,21 +1193,8 @@ class DeviceConfig:
def
__init__
(
self
,
device
:
str
=
"auto"
)
->
None
:
if
device
==
"auto"
:
# Automated device type detection
if
current_platform
.
is_cuda_alike
():
self
.
device_type
=
"cuda"
elif
current_platform
.
is_neuron
():
self
.
device_type
=
"neuron"
elif
current_platform
.
is_hpu
():
self
.
device_type
=
"hpu"
elif
current_platform
.
is_openvino
():
self
.
device_type
=
"openvino"
elif
current_platform
.
is_tpu
():
self
.
device_type
=
"tpu"
elif
current_platform
.
is_cpu
():
self
.
device_type
=
"cpu"
elif
current_platform
.
is_xpu
():
self
.
device_type
=
"xpu"
else
:
self
.
device_type
=
current_platform
.
device_type
if
self
.
device_type
is
None
:
raise
RuntimeError
(
"Failed to infer device type"
)
else
:
# Device type is assigned explicitly
...
...
vllm/platforms/cpu.py
View file @
9d827170
...
...
@@ -19,6 +19,7 @@ logger = init_logger(__name__)
class
CpuPlatform
(
Platform
):
_enum
=
PlatformEnum
.
CPU
device_type
:
str
=
"cpu"
@
classmethod
def
get_device_name
(
cls
,
device_id
:
int
=
0
)
->
str
:
...
...
vllm/platforms/cuda.py
View file @
9d827170
...
...
@@ -109,6 +109,7 @@ def device_id_to_physical_device_id(device_id: int) -> int:
class
CudaPlatform
(
Platform
):
_enum
=
PlatformEnum
.
CUDA
device_type
:
str
=
"cuda"
@
classmethod
def
get_device_capability
(
cls
,
device_id
:
int
=
0
)
->
DeviceCapability
:
...
...
vllm/platforms/hpu.py
View file @
9d827170
...
...
@@ -5,6 +5,7 @@ from .interface import Platform, PlatformEnum, _Backend
class
HpuPlatform
(
Platform
):
_enum
=
PlatformEnum
.
HPU
device_type
:
str
=
"hpu"
@
classmethod
def
get_default_attn_backend
(
cls
,
selected_backend
:
_Backend
)
->
_Backend
:
...
...
vllm/platforms/interface.py
View file @
9d827170
...
...
@@ -56,6 +56,7 @@ class DeviceCapability(NamedTuple):
class
Platform
:
_enum
:
PlatformEnum
device_type
:
str
def
is_cuda
(
self
)
->
bool
:
return
self
.
_enum
==
PlatformEnum
.
CUDA
...
...
vllm/platforms/neuron.py
View file @
9d827170
...
...
@@ -3,6 +3,7 @@ from .interface import Platform, PlatformEnum
class
NeuronPlatform
(
Platform
):
_enum
=
PlatformEnum
.
NEURON
device_type
:
str
=
"neuron"
@
classmethod
def
get_device_name
(
cls
,
device_id
:
int
=
0
)
->
str
:
...
...
vllm/platforms/openvino.py
View file @
9d827170
...
...
@@ -10,6 +10,7 @@ logger = init_logger(__name__)
class
OpenVinoPlatform
(
Platform
):
_enum
=
PlatformEnum
.
OPENVINO
device_type
:
str
=
"openvino"
@
classmethod
def
get_default_attn_backend
(
cls
,
selected_backend
:
_Backend
)
->
_Backend
:
...
...
vllm/platforms/rocm.py
View file @
9d827170
...
...
@@ -29,6 +29,7 @@ if os.environ.get("VLLM_WORKER_MULTIPROC_METHOD", None) in ["fork", None]:
class
RocmPlatform
(
Platform
):
_enum
=
PlatformEnum
.
ROCM
device_type
:
str
=
"cuda"
@
classmethod
def
get_default_attn_backend
(
cls
,
selected_backend
:
_Backend
)
->
_Backend
:
...
...
vllm/platforms/tpu.py
View file @
9d827170
...
...
@@ -16,6 +16,7 @@ logger = init_logger(__name__)
class
TpuPlatform
(
Platform
):
_enum
=
PlatformEnum
.
TPU
device_type
:
str
=
"tpu"
@
classmethod
def
get_default_attn_backend
(
cls
,
selected_backend
:
_Backend
)
->
_Backend
:
...
...
vllm/platforms/xpu.py
View file @
9d827170
...
...
@@ -16,6 +16,7 @@ logger = init_logger(__name__)
class
XPUPlatform
(
Platform
):
_enum
=
PlatformEnum
.
XPU
device_type
:
str
=
"xpu"
@
classmethod
def
get_default_attn_backend
(
cls
,
selected_backend
:
_Backend
)
->
_Backend
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment