[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:
2918c1b49c

---------

Signed-off-by: gcanlin <canlinguosdu@gmail.com>
This commit is contained in:
Canlin Guo
2025-11-14 11:32:51 +08:00
committed by GitHub
parent 094f32c8c9
commit f10251ede0

View File

@@ -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,