[Bugfix] Format kernel-import errors eagerly so warning_once does not retain them (#54098)

Signed-off-by: Zeyu Wang <zwang86@users.noreply.github.com>
Co-authored-by: Zeyu Wang <zwang86@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
zwang86
2026-09-15 16:35:54 -04:00
committed by GitHub
co-authored by Zeyu Wang mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 38ca7a899c
commit b6ce714354
3 changed files with 12 additions and 6 deletions
+8 -4
View File
@@ -605,26 +605,30 @@ class CpuPlatform(Platform):
try:
import vllm._C # noqa: F401
except ImportError as e:
logger.warning_once("Failed to import from vllm._C: %r", e)
logger.warning_once(
"Failed to import from vllm._C: %s", repr(e)
)
else:
try:
import vllm._C_AVX512 # noqa: F401
except ImportError as e:
if ignored_msg not in e.msg:
logger.warning_once(
"Failed to import from vllm._C_AVX512: %r", e
"Failed to import from vllm._C_AVX512: %s", repr(e)
)
else:
try:
import vllm._C_AVX2 # noqa: F401
except ImportError as e:
if ignored_msg not in e.msg:
logger.warning_once("Failed to import from vllm._C_AVX2: %r", e)
logger.warning_once(
"Failed to import from vllm._C_AVX2: %s", repr(e)
)
else:
try:
import vllm._C # noqa: F401
except ImportError as e:
logger.warning_once("Failed to import from vllm._C: %r", e)
logger.warning_once("Failed to import from vllm._C: %s", repr(e))
@classmethod
def pack_kv_cache(
+3 -1
View File
@@ -239,7 +239,9 @@ class CudaPlatformBase(Platform):
try:
import vllm._C_stable_libtorch # noqa: F401
except ImportError as e:
logger.warning_once("Failed to import from vllm._C_stable_libtorch: %r", e)
logger.warning_once(
"Failed to import from vllm._C_stable_libtorch: %s", repr(e)
)
with contextlib.suppress(ImportError):
import vllm._moe_C_stable_libtorch # noqa: F401
with contextlib.suppress(ImportError):
+1 -1
View File
@@ -365,7 +365,7 @@ class Platform:
try:
import vllm._C # noqa: F401
except ImportError as e:
logger.warning_once("Failed to import from vllm._C: %r", e)
logger.warning_once("Failed to import from vllm._C: %s", repr(e))
with contextlib.suppress(ImportError):
import vllm._moe_C_stable_libtorch # noqa: F401