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
60cad94b
Unverified
Commit
60cad94b
authored
May 23, 2025
by
Ning Xie
Committed by
GitHub
May 22, 2025
Browse files
[Hardware] correct method signatures for HPU,ROCm,XPU (#18551)
Signed-off-by:
Andy Xie
<
andy.xning@gmail.com
>
parent
9c1baa5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
16 deletions
+16
-16
vllm/platforms/__init__.py
vllm/platforms/__init__.py
+4
-6
vllm/platforms/hpu.py
vllm/platforms/hpu.py
+2
-2
vllm/platforms/rocm.py
vllm/platforms/rocm.py
+2
-2
vllm/platforms/xpu.py
vllm/platforms/xpu.py
+8
-6
No files found.
vllm/platforms/__init__.py
View file @
60cad94b
...
...
@@ -42,7 +42,6 @@ def tpu_platform_plugin() -> Optional[str]:
logger
.
debug
(
"Confirmed TPU platform is available."
)
except
Exception
as
e
:
logger
.
debug
(
"TPU platform is not available because: %s"
,
str
(
e
))
pass
return
"vllm.platforms.tpu.TpuPlatform"
if
is_tpu
else
None
...
...
@@ -112,7 +111,6 @@ def rocm_platform_plugin() -> Optional[str]:
amdsmi
.
amdsmi_shut_down
()
except
Exception
as
e
:
logger
.
debug
(
"ROCm platform is not available because: %s"
,
str
(
e
))
pass
return
"vllm.platforms.rocm.RocmPlatform"
if
is_rocm
else
None
...
...
@@ -130,7 +128,6 @@ def hpu_platform_plugin() -> Optional[str]:
"habana_frameworks is not found."
)
except
Exception
as
e
:
logger
.
debug
(
"HPU platform is not available because: %s"
,
str
(
e
))
pass
return
"vllm.platforms.hpu.HpuPlatform"
if
is_hpu
else
None
...
...
@@ -148,7 +145,6 @@ def xpu_platform_plugin() -> Optional[str]:
logger
.
debug
(
"Confirmed XPU platform is available."
)
except
Exception
as
e
:
logger
.
debug
(
"XPU platform is not available because: %s"
,
str
(
e
))
pass
return
"vllm.platforms.xpu.XPUPlatform"
if
is_xpu
else
None
...
...
@@ -170,7 +166,6 @@ def cpu_platform_plugin() -> Optional[str]:
except
Exception
as
e
:
logger
.
debug
(
"CPU platform is not available because: %s"
,
str
(
e
))
pass
return
"vllm.platforms.cpu.CpuPlatform"
if
is_cpu
else
None
...
...
@@ -222,8 +217,11 @@ def resolve_current_platform_cls_qualname() -> str:
platform_cls_qualname
=
func
()
if
platform_cls_qualname
is
not
None
:
activated_plugins
.
append
(
name
)
logger
.
info
(
"Platform plugin %s loaded."
,
name
)
logger
.
warning
(
"Platform plugin %s function's return value is None"
,
name
)
except
Exception
:
pass
logger
.
exception
(
"Failed to load platform plugin %s"
,
name
)
activated_builtin_plugins
=
list
(
set
(
activated_plugins
)
&
set
(
builtin_platform_plugins
.
keys
()))
...
...
vllm/platforms/hpu.py
View file @
60cad94b
...
...
@@ -39,8 +39,8 @@ class HpuPlatform(Platform):
def
is_async_output_supported
(
cls
,
enforce_eager
:
Optional
[
bool
])
->
bool
:
return
True
@
static
method
def
inference_mode
():
@
class
method
def
inference_mode
(
cls
):
return
torch
.
no_grad
()
@
classmethod
...
...
vllm/platforms/rocm.py
View file @
60cad94b
...
...
@@ -217,9 +217,9 @@ class RocmPlatform(Platform):
major
,
minor
=
torch
.
cuda
.
get_device_capability
(
device_id
)
return
DeviceCapability
(
major
=
major
,
minor
=
minor
)
@
static
method
@
class
method
@
with_amdsmi_context
def
is_fully_connected
(
physical_device_ids
:
list
[
int
])
->
bool
:
def
is_fully_connected
(
cls
,
physical_device_ids
:
list
[
int
])
->
bool
:
"""
Query if the set of gpus are fully connected by xgmi (1 hop)
"""
...
...
vllm/platforms/xpu.py
View file @
60cad94b
...
...
@@ -37,15 +37,17 @@ class XPUPlatform(Platform):
logger
.
info
(
"Using IPEX attention backend."
)
return
"vllm.attention.backends.ipex_attn.IpexAttnBackend"
@
static
method
@
class
method
def
get_device_capability
(
device_id
:
int
=
0
)
->
Optional
[
DeviceCapability
]:
cls
,
device_id
:
int
=
0
,
)
->
Optional
[
DeviceCapability
]:
# capacity format differs from cuda's and will cause unexpected
# failure, so use None directly
return
None
@
static
method
def
get_device_name
(
device_id
:
int
=
0
)
->
str
:
@
class
method
def
get_device_name
(
cls
,
device_id
:
int
=
0
)
->
str
:
return
torch
.
xpu
.
get_device_name
(
device_id
)
@
classmethod
...
...
@@ -57,8 +59,8 @@ class XPUPlatform(Platform):
def
is_async_output_supported
(
cls
,
enforce_eager
:
Optional
[
bool
])
->
bool
:
return
True
@
static
method
def
inference_mode
():
@
class
method
def
inference_mode
(
cls
):
return
torch
.
no_grad
()
@
classmethod
...
...
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