Support kunlunxin backend - #268
Conversation
| output_final_state, | ||
| cu_seqlens, | ||
| use_qk_l2norm_in_kernel, | ||
| ) |
| stacklevel=2, | ||
| ) | ||
| q, k, v, beta, g = map( |
| global _patched | ||
| if _patched: | ||
| return | ||
| _patched = True |
| key_cache: torch.Tensor, | ||
| value_cache: torch.Tensor, | ||
| slot_mapping: torch.Tensor, | ||
| k_max: torch.Tensor | None = None, | ||
| v_max: torch.Tensor | None = None, | ||
| quant_mode: int = 0, | ||
| force_sdnn: bool = False, | ||
| BLHD_LAYOUT: bool = True) -> int: | ||
| """ | ||
| reshape and store key and value in cache_key, cache_value, respectively. | ||
|
|
| max_query_len = common_attn_metadata.max_query_len | ||
| block_table_tensor = common_attn_metadata.block_table_tensor | ||
| slot_mapping = common_attn_metadata.slot_mapping | ||
| seq_lens_cpu = common_attn_metadata.seq_lens_cpu |
| try: | ||
| import torch_xmlir # noqa: F401 | ||
| import xtorch_ops | ||
| _KUNLUNXIN_OPS_AVAILABLE = True |
| import logging | ||
| import math | ||
| from dataclasses import dataclass | ||
| from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Tuple, Type |
b3f9ffc to
51573ff
Compare
| global _patches_applied | ||
| if _patches_applied: | ||
| return | ||
| _patches_applied = True |
| is_conv_state_dim_first = gdn_mod.is_conv_state_dim_first | ||
| causal_conv1d_fn = gdn_mod.causal_conv1d_fn | ||
| causal_conv1d_update = gdn_mod.causal_conv1d_update | ||
| fused_post_conv_prep = gdn_mod.fused_post_conv_prep |
|
what's xtorch_ops ? |
|
add pr description |
8078584 to
b38390f
Compare
b38390f to
511a39a
Compare
bb87fef to
0b5968a
Compare
- fused_moe_utils.py: rollback to correct-container version, remove broken is_cuda() guard so XPU takes fast path with proper return statement - worker.py: rollback to restore NPU compatibility code (empty_cache patch, profile_run skip, _dummy_run skip)
0b5968a to
8318c25
Compare
…rmatting - Remove unused imports: Enum, rocm_aiter_ops, MoEBackend, has_flashinfer_cutlass_fused_moe, triton (only tl is used) - Restore multi-line import style for oracle.unquantized, fused_moe, fused_moe.utils - Move current_platform import back to original position - Restore multi-line function signature for select_unquantized_moe_backend_oot - Remove trailing whitespace on use_flaggems() condition line - Restore blank lines between top-level definitions
08fb5ac to
e627bf8
Compare
|
|
||
| # Apply Sunrise/PTPU monkey-patches if running on PTPU. | ||
| if current_platform.device_type == "ptpu": | ||
| from vllm_fl.dispatch.backends.vendor.sunrise.patch import apply_sunrise_patches |
|
|
||
| # 1.3: Validate activation function | ||
| SUPPORTED_ACTIVATIONS = ["silu", "gelu", "relu", "gelu_no_mul", "silu_no_mul"] | ||
| if activation not in SUPPORTED_ACTIVATIONS: |
There was a problem hiding this comment.
In vLLM 0.20.2, MoEActivation is a plain Enum, FusedMoE stores the parsed enum, and the unquantized path passes layer.activation directly to the kernel. Therefore this string comparison rejects even MoEActivation.SILU. The list also uses relu, while vLLM defines RELU2 = "relu2". Please normalize enum values before validation and align the supported names with MoEActivation.
| ) | ||
|
|
||
| # Reject varlen mode with query_start_loc: not supported by native kernel | ||
| if query_start_loc is not None and max_query_len > 0: |
There was a problem hiding this comment.
This guard rejects only when both arguments are set. If query_start_loc is provided alone, or max_query_len > 0 alone, the unsupported value is still silently ignored. Please reject either non-default argument (use or) or validate the supported combinations explicitly.
PR Category
Others
PR Type
New Features
Description
Based on vLLM 0.20.2 (empty), adapted for vllm-plugin-FL with support for the Kunlunxin backend.The Qwen3.6-35B-A3B and Qwen3.6-27B models have been verified, the test includes high-concurrency input of text and images.
Test command:
export FLAGCX_PATH=/workspace/FlagCX
export USE_RESHAPE_AND_CACHE_FLASH=1
vllm serve /workspace/models/Qwen3.6-27B
--served-model-name qwen3
--tensor-parallel-size 4
--max-model-len 16384
--reasoning-parser qwen3
--block-size 128
--gpu-memory-utilization 0.8
--enforce-eager
--port 8100
Verified results:

Changes
Add Kunlunxin backend support.
Testing
Checklist