mirror of
https://github.com/handsomezhuzhu/vllm-npu-plugin.git
synced 2026-02-20 11:42:30 +00:00
feat: Improve SOC version detection and sleep mode handling in utils.py
This commit is contained in:
@@ -67,8 +67,12 @@ _IS_EAGLE_MODE = None
|
|||||||
def is_310p():
|
def is_310p():
|
||||||
global _IS_310P
|
global _IS_310P
|
||||||
if _IS_310P is None:
|
if _IS_310P is None:
|
||||||
from vllm_npu import _build_info # type: ignore
|
try:
|
||||||
_IS_310P = _build_info.__soc_version__.lower().startswith("ascend310p")
|
soc_version = torch_npu.npu.get_soc_version()
|
||||||
|
# 310P soc_version range: 200-209
|
||||||
|
_IS_310P = 200 <= soc_version <= 209
|
||||||
|
except Exception:
|
||||||
|
_IS_310P = False
|
||||||
return _IS_310P
|
return _IS_310P
|
||||||
|
|
||||||
|
|
||||||
@@ -93,8 +97,13 @@ def is_enable_nz(dtype: Optional[torch.dtype] = torch.int8,
|
|||||||
def sleep_mode_enabled():
|
def sleep_mode_enabled():
|
||||||
global _SLEEP_MODE_ENABLED
|
global _SLEEP_MODE_ENABLED
|
||||||
if _SLEEP_MODE_ENABLED is None:
|
if _SLEEP_MODE_ENABLED is None:
|
||||||
from vllm_npu import _build_info # type: ignore
|
# _build_info is a C++ build artifact from vllm-ascend CMake.
|
||||||
_SLEEP_MODE_ENABLED = _build_info.__sleep_mode_enabled__
|
# For the plugin, detect at runtime or default to False.
|
||||||
|
try:
|
||||||
|
from vllm_npu import _build_info # type: ignore
|
||||||
|
_SLEEP_MODE_ENABLED = _build_info.__sleep_mode_enabled__
|
||||||
|
except ImportError:
|
||||||
|
_SLEEP_MODE_ENABLED = False
|
||||||
return _SLEEP_MODE_ENABLED
|
return _SLEEP_MODE_ENABLED
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user