Skip to content

Commit 6eb411e

Browse files
Merge remote-tracking branch 'origin/v0.3.0-dev' into fix/iluvatar-triton-stub
2 parents b1e7aed + a19ee81 commit 6eb411e

7 files changed

Lines changed: 966 additions & 421 deletions

File tree

vllm_fl/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) 2025 BAAI. All rights reserved.
22

3+
import importlib
34
import os
45
import logging
56
import sys
@@ -77,12 +78,13 @@ def _patch_flash_attn_import():
7778

7879

7980
def _patch_custom_ops():
80-
"""Register torch.ops._C op schemas when vllm._C is unavailable."""
81-
try:
82-
import vllm._C # noqa: F401
83-
return
84-
except (ImportError, OSError):
85-
pass
81+
"""Register fallback schemas when neither vLLM extension ABI is present."""
82+
for module_name in ("vllm._C", "vllm._C_stable_libtorch"):
83+
try:
84+
importlib.import_module(module_name)
85+
return
86+
except (ImportError, OSError):
87+
continue
8688

8789
try:
8890
import vllm_fl._C # noqa: F401

vllm_fl/attention/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ def patch_mm_encoder_attention():
1515
"""
1616
import vllm.model_executor.layers.attention.mm_encoder_attention as mm_mod
1717
from vllm.v1.attention.backends.registry import AttentionBackendEnum
18+
from vllm.platforms import current_platform
19+
20+
# PlatformFL is registered as an OOT platform, so CustomOp would otherwise
21+
# bind MMEncoderAttention to forward_oot -> forward_native (Torch SDPA).
22+
# NVIDIA must keep vLLM's CUDA dispatch so the selected FLASH_ATTN backend
23+
# is actually used during multimodal profiling and inference.
24+
if current_platform.is_cuda():
25+
mm_mod.MMEncoderAttention.forward_oot = mm_mod.MMEncoderAttention.forward_cuda
1826

1927
def _patched_maybe_get_vit_flash_attn_backend(attn_backend):
2028
if attn_backend == AttentionBackendEnum.FLASH_ATTN:

vllm_fl/dispatch/backends/vendor/metax/patches/pynccl_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def ncclCommWindowDeregister(self, comm: ncclComm_t, window: ncclWindow_t) -> No
463463

464464
def _compile_friendly_all_reduce(self, input_):
465465
"""Use torch.distributed all_reduce which Dynamo can trace."""
466-
dist.all_reduce(input_, op=dist.ReduceOp.SUM)
466+
dist.all_reduce(input_, op=dist.ReduceOp.SUM, group=self.device_group)
467467
return input_
468468

469469

vllm_fl/ops/fused_moe/fused_moe_utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,13 @@ def _return_or_raise(
154154

155155
return _return_or_raise(requested_backend, moe_config, activation_format)
156156

157-
# Handle explicit FlashInfer FP16 configuration.
158-
if envs.is_set("VLLM_USE_FLASHINFER_MOE_FP16"):
159-
if not envs.VLLM_USE_FLASHINFER_MOE_FP16:
157+
# Handle explicit FlashInfer FP16 configuration. vLLM 0.24 removed
158+
# this legacy name from vllm.envs, so read it directly from os.environ.
159+
if "VLLM_USE_FLASHINFER_MOE_FP16" in os.environ:
160+
use_flashinfer_moe_fp16 = os.environ[
161+
"VLLM_USE_FLASHINFER_MOE_FP16"
162+
].strip().lower() in ("1", "true")
163+
if not use_flashinfer_moe_fp16:
160164
if UnquantizedMoeBackend.FLASHINFER_TRTLLM in AVAILABLE_BACKENDS:
161165
AVAILABLE_BACKENDS.remove(UnquantizedMoeBackend.FLASHINFER_TRTLLM)
162166
if UnquantizedMoeBackend.FLASHINFER_CUTLASS in AVAILABLE_BACKENDS:

vllm_fl/platform.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
import torch
1212

13-
# import custom ops, trigger op registration (CUDA only)
14-
try:
15-
import vllm._C # noqa
16-
import vllm._C_stable_libtorch # noqa
17-
except (ImportError, OSError):
18-
pass # NPU or other platforms may not have vllm._C
13+
# Import custom ops and trigger registration on both legacy and stable-ABI
14+
# vLLM wheels. Keep the attempts independent: official vLLM 0.24 wheels have
15+
# only the stable-ABI module, so failure of the legacy import must not skip it.
16+
import importlib
17+
for _extension in ("vllm._C", "vllm._C_stable_libtorch"):
18+
try:
19+
importlib.import_module(_extension)
20+
except (ImportError, OSError):
21+
pass # Non-CUDA platforms may not ship either extension.
1922

2023
from vllm.logger import init_logger
2124
from vllm.platforms import Platform, PlatformEnum
@@ -220,7 +223,8 @@ def check_and_update_config(cls, vllm_config: "VllmConfig") -> None:
220223
compilation_config.cudagraph_mode = CUDAGraphMode.PIECEWISE
221224

222225
if (
223-
parallel_config.data_parallel_size > 1
226+
parallel_config.all2all_backend == "deepep_high_throughput"
227+
and parallel_config.data_parallel_size > 1
224228
and compilation_config.cudagraph_mode != CUDAGraphMode.NONE
225229
):
226230
# TODO: Piecewise Cuda graph might be enabled

0 commit comments

Comments
 (0)