[Model] Support Qwen3.8-Flash-Next (#53896)

Signed-off-by: huanghaoyan.hhy <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: andyluo7 <andy.luo@amd.com>
Signed-off-by: lishunyang12 <lishunyang03@gmail.com>
Signed-off-by: Harry Huang <huanghaoyan.hhy@alibaba-inc.com>
Signed-off-by: Thien Tran <gau.nernst@yahoo.com.sg>
Signed-off-by: Isotr0py <Isotr0py@outlook.com>
Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
Signed-off-by: Yifan Qiao <yifanqiao@inferact.ai>
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com>
Co-authored-by: zjy0516 <riverclouds.zhu@qq.com>
Co-authored-by: KungYork <firelikest@163.com>
Co-authored-by: Thien Tran <gau.nernst@yahoo.com.sg>
Co-authored-by: Yifan Qiao <yifanqiao@inferact.ai>
Co-authored-by: andyluo7 <43718156+andyluo7@users.noreply.github.com>
Co-authored-by: Isotr0py <mozf@inferact.ai>
Co-authored-by: andyluo7 <andy.luo@amd.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: lishunyang12 <lishunyang03@gmail.com>
Co-authored-by: Vadim Gimpelson <156319763+vadiklyutiy@users.noreply.github.com>
Co-authored-by: Isotr0py <Isotr0py@outlook.com>
Co-authored-by: Lucas Wilkinson <lwilkins@redhat.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Harry Huang
2026-08-31 05:57:56 +00:00
committed by GitHub
co-authored by zjy0516 KungYork Thien Tran Yifan Qiao andyluo7 Isotr0py andyluo7 OpenAI Codex lishunyang12 Vadim Gimpelson Isotr0py Lucas Wilkinson Claude Opus 5 OpenAI Codex
parent 687db59744
commit e126687a9a
124 changed files with 19424 additions and 450 deletions
+15 -3
View File
@@ -66,6 +66,7 @@ from vllm.model_executor.layers.fused_moe.routed_experts_capturer import (
RoutedExpertsCapturer,
bind_routed_experts_capturer,
)
from vllm.model_executor.layers.mamba.mamba_utils import MambaStateCopyFuncsByType
from vllm.model_executor.layers.mamba.ops.ssu_dispatch import (
initialize_mamba_ssu_backend,
)
@@ -997,6 +998,7 @@ class GPUModelRunner(
self.kv_connector_output: KVConnectorOutput | None = None
self.mamba_state_idx: dict[str, int] = {}
self._mamba_bufs: mamba_utils.MambaBuffers | None = None
self._mamba_state_copy_funcs: MambaStateCopyFuncsByType | None = None
self.mamba_prev_last_scheduled_idx: CpuGpuBuffer | None = None
if self.cache_config.mamba_cache_mode == "all" and self.num_spec_tokens > 0:
self.mamba_prev_last_scheduled_idx = self._make_buffer(
@@ -1053,6 +1055,15 @@ class GPUModelRunner(
with_numpy=numpy,
)
def _get_mamba_state_copy_funcs(self) -> MambaStateCopyFuncsByType:
if self._mamba_state_copy_funcs is None:
mamba_groups = mamba_utils.get_mamba_groups(self.kv_cache_config)
mamba_types = {spec.mamba_type for spec in mamba_groups}
copy_funcs = self.model.get_mamba_state_copy_funcs(mamba_types)
mamba_utils.validate_mamba_state_copy_funcs(mamba_groups, copy_funcs)
self._mamba_state_copy_funcs = copy_funcs
return self._mamba_state_copy_funcs
def _get_mamba_bufs(self) -> mamba_utils.MambaBuffers:
# Only reachable on the ``mamba_cache_mode == "align"`` path.
# The postprocess sub-object is additionally gated on spec
@@ -1062,7 +1073,7 @@ class GPUModelRunner(
self._mamba_bufs = mamba_utils.MambaBuffers.create(
max_num_reqs=self.max_num_reqs,
kv_cache_config=self.kv_cache_config,
copy_funcs=self.model.get_mamba_state_copy_func(),
copy_funcs=self._get_mamba_state_copy_funcs(),
make_buffer=self._make_buffer,
device=self.device,
with_postprocess_align=(
@@ -1599,7 +1610,7 @@ class GPUModelRunner(
input_batch=self.input_batch,
kv_cache_config=self.kv_cache_config,
forward_context=self.compilation_config.static_forward_context,
mamba_state_copy_funcs=self.model.get_mamba_state_copy_func(),
mamba_state_copy_funcs=self._get_mamba_state_copy_funcs(),
)
assert self.num_accepted_tokens_event is not None
@@ -4404,7 +4415,7 @@ class GPUModelRunner(
self.input_batch,
self.requests,
self.compilation_config.static_forward_context,
self.model.get_mamba_state_copy_func(),
self._get_mamba_state_copy_funcs(),
mamba_bufs.preprocess,
align_ctx=mamba_bufs.postprocess_align,
)
@@ -7488,6 +7499,7 @@ class GPUModelRunner(
kv_cache_config = deepcopy(kv_cache_config)
self.kv_cache_config = kv_cache_config
self._mamba_bufs = None
self._mamba_state_copy_funcs = None
self.may_add_encoder_only_layers_to_kv_cache_config()
self.maybe_add_kv_sharing_layers_to_kv_cache_groups(kv_cache_config)
self.initialize_attn_backend(kv_cache_config, is_profiling=is_profiling)