[Rebase] Align vLLM-Omni with vLLM v0.31.0 (#8459)

Signed-off-by: tzhouam <tzhouam@connect.ust.hk>
This commit is contained in:
Zhou Taichang authored and GitHub committed 2026-10-05 14:11:01 +08:00
1 parent 1f47fa2f29
commit 0b0d2d7009
141 files changed
+2885 -721

No files matched your search

-47
View File
@@ -45,7 +45,6 @@ from vllm_omni.utils.device_copy import index_to_device
if TYPE_CHECKING:
from vllm.v1.core.sched.output import SchedulerOutput
from vllm.v1.outputs import RoutedExpertsLists
else:
xgr = LazyLoader("xgr", globals(), "xgrammar")
xgr_torch_compile = LazyLoader(
@@ -108,52 +107,6 @@ class OmniGPUModelRunner(PrefixCacheRunnerMixin, GPUModelRunner):
return sampled
return super()._to_list(sampled_token_ids)
def _omni_routed_experts_d2h(self, scheduler_output) -> None:
"""Issue routed-experts D2H copy matching upstream GPUModelRunner pattern.
Upstream does this inline in ``execute_model``:
buf = self.routed_experts_capturer.get_device_buffer()
total = scheduler_output.total_num_scheduled_tokens
self.routed_experts_cpu[:total].copy_(buf[:total], non_blocking=True)
self.routed_experts_slot_mapping_cpu[:total].copy_(
self.routed_experts_slot_mapping_device[:total], non_blocking=True)
"""
if not self.routed_experts_initialized:
return
buf = self.routed_experts_capturer.get_device_buffer()
total = scheduler_output.total_num_scheduled_tokens
self.routed_experts_cpu[:total].copy_(buf[:total], non_blocking=True)
if hasattr(self, "routed_experts_slot_mapping_device"):
self.routed_experts_slot_mapping_cpu[:total].copy_(
self.routed_experts_slot_mapping_device[:total],
non_blocking=True,
)
def _omni_extract_routed_experts(self, scheduler_output) -> "RoutedExpertsLists | None":
"""Extract routed experts matching upstream GPUModelRunner pattern.
Upstream (sync path, sample_tokens):
total = scheduler_output.total_num_scheduled_tokens
output.routed_experts = RoutedExpertsLists(
routing_data=self.routed_experts_cpu[:total].numpy(),
slot_mapping=self.routed_experts_slot_mapping_cpu[:total].numpy(),
)
Returns RoutedExpertsLists (batch-level, with slot_mapping) so that
downstream schedulers can use slot_mapping to map back to requests.
"""
from vllm.v1.outputs import RoutedExpertsLists
if not self.routed_experts_initialized:
return None
total = scheduler_output.total_num_scheduled_tokens
if total <= 0:
return None
return RoutedExpertsLists(
routing_data=self.routed_experts_cpu[:total].numpy(),
slot_mapping=self.routed_experts_slot_mapping_cpu[:total].numpy(),
)
def initialize_metadata_builders(self, kv_cache_config, kernel_block_sizes):
"""Initialize metadata builders and keep FA3 graph metadata buffers sized.