[Fix] [NPU] pre_warm_nccl: init npu backend before the parallel runtime touches a device (#43039)

This commit is contained in:
amote-i
2026-10-21 19:44:30 +08:00
committed by GitHub
parent fda84f80b7
commit 2815eed49c
@@ -114,6 +114,12 @@ def init_parallel_runtime(
tic = time.perf_counter()
logger.info("Init parallel begin.")
# NPU: install transfer_to_npu to route torch.cuda.* to torch.npu.*
if is_npu():
from sglang.srt.hardware_backend.npu.utils import init_npu_backend
init_npu_backend()
backend = _resolve_backend(device=device)
if not get_parallel().enable_p2p_check:
monkey_patch_p2p_access_check()