From f10251ede02db870582b59a6d9aa07dea959f6f6 Mon Sep 17 00:00:00 2001 From: Canlin Guo Date: Fri, 14 Nov 2025 11:32:51 +0800 Subject: [PATCH] [Platform] Add import_kernels interface (#3694) ### What this PR does / why we need it? Add import_kernels interface to avoid import useless vLLM C library Closes #3488. Reopen #3498 for CI. ### How was this patch tested? CI tested. - vLLM version: v0.11.0 - vLLM main: https://github.com/vllm-project/vllm/commit/2918c1b49c88c29783c86f78d2c4221cb9622379 --------- Signed-off-by: gcanlin --- vllm_ascend/platform.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vllm_ascend/platform.py b/vllm_ascend/platform.py index 0d295548..1c2a3391 100644 --- a/vllm_ascend/platform.py +++ b/vllm_ascend/platform.py @@ -370,6 +370,17 @@ class NPUPlatform(Platform): "needs to be equal if use cp or dcp > 1 in P/D disaggregate scenario." ) + @classmethod + def import_kernels(cls) -> None: + # Directly importing vllm_ascend_C prevents ASCEND_RT_VISIBLE_DEVICES + # from being applied during runtime initialization, which causes bugs + # in the RL module. Therefore, we currently use lazy initialization + # to avoid this issue. See https://github.com/vllm-project/vllm-ascend/pull/884. + # TODO: when the above issue is fixed, we can uncomment the following lines. + # from vllm_ascend.utils import enable_custom_op + # enable_custom_op() + pass + @classmethod def get_attn_backend_cls( cls,