[Rebase] Rebase to vllm 0.28.0 (#6606)
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
da4a08b65b
commit
651b03225b
42 files changed
+931
-121
No files matched your search
@@ -1,3 +1,6 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project
|
||||
|
||||
"""AR GPU Model Runner for vLLM-Omni.
|
||||
|
||||
Exposes per-request hidden representations via ModelRunnerOutput.pooler_output
|
||||
@@ -169,6 +172,7 @@ class OmniAsyncGPUModelRunnerOutput(AsyncGPUModelRunnerOutput):
|
||||
async_output_copy_stream = kwargs.pop("async_output_copy_stream")
|
||||
vocab_size = kwargs.pop("vocab_size")
|
||||
routed_experts = kwargs.pop("routed_experts", None)
|
||||
num_nans = kwargs.pop("num_nans", None)
|
||||
# Upstream AsyncGPUModelRunnerOutput added check_ep_fault / _has_fault
|
||||
# for EP all2all fault tolerance (PR #43637). Omni doesn't use this
|
||||
# feature but must consume the kwarg to prevent TypeError from stray
|
||||
@@ -186,6 +190,11 @@ class OmniAsyncGPUModelRunnerOutput(AsyncGPUModelRunnerOutput):
|
||||
self._logprobs_tensors = logprobs_tensors
|
||||
self._routed_experts = routed_experts
|
||||
self._has_fault: torch.Tensor | None = None
|
||||
# Upstream b1e12d142d (PR #51304) added device-side NaN-in-logits
|
||||
# counts (num_nans) to AsyncGPUModelRunnerOutput. Omni keeps the
|
||||
# counts on the async copy stream and lets super().get_output()
|
||||
# populate num_nans_in_logits from the CPU copy.
|
||||
self._num_nans = num_nans
|
||||
|
||||
default_stream = torch.cuda.current_stream()
|
||||
with torch.cuda.stream(async_output_copy_stream):
|
||||
@@ -199,6 +208,7 @@ class OmniAsyncGPUModelRunnerOutput(AsyncGPUModelRunnerOutput):
|
||||
self._routed_experts_cpu = (
|
||||
self._routed_experts.to_cpu_nonblocking() if self._routed_experts is not None else None
|
||||
)
|
||||
self._num_nans_cpu = self._num_nans.to("cpu", non_blocking=True) if self._num_nans is not None else None
|
||||
self.async_copy_ready_event.record()
|
||||
|
||||
self._model_runner_output_builder = model_runner_output_builder
|
||||
@@ -242,6 +252,12 @@ class OmniAsyncGPUModelRunnerOutput(AsyncGPUModelRunnerOutput):
|
||||
# (e.g. unit tests using object.__new__).
|
||||
if not hasattr(self, "_has_fault"):
|
||||
self._has_fault = None
|
||||
# Upstream b1e12d142d (PR #51304) also touches _num_nans/_num_nans_cpu
|
||||
# in get_output(). Guard them the same way for object.__new__ tests.
|
||||
if not hasattr(self, "_num_nans"):
|
||||
self._num_nans = None
|
||||
if not hasattr(self, "_num_nans_cpu"):
|
||||
self._num_nans_cpu = None
|
||||
with record_function_or_nullcontext("omni_async_output:get_output/finalize_async_sampled_tokens"):
|
||||
return super().get_output()
|
||||
|
||||
@@ -1030,9 +1046,8 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin, Duplex
|
||||
max_num_scheduled_tokens = int(num_scheduled_tokens_np.max())
|
||||
num_tokens_unpadded = scheduler_output.total_num_scheduled_tokens
|
||||
|
||||
logits_indices, spec_decode_metadata = self._prepare_inputs(
|
||||
scheduler_output,
|
||||
num_scheduled_tokens_np,
|
||||
logits_indices, spec_decode_metadata, max_num_sampled_tokens = self._prepare_inputs(
|
||||
scheduler_output, num_scheduled_tokens_np
|
||||
)
|
||||
|
||||
cascade_attn_prefix_lens = None
|
||||
@@ -1126,6 +1141,7 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin, Duplex
|
||||
max_query_len=max_num_scheduled_tokens,
|
||||
ubatch_slices=ubatch_slices_attn,
|
||||
logits_indices=logits_indices,
|
||||
max_num_sampled_tokens=max_num_sampled_tokens,
|
||||
use_spec_decode=use_spec_decode,
|
||||
num_scheduled_tokens=scheduler_output.num_scheduled_tokens,
|
||||
cascade_attn_prefix_lens=cascade_attn_prefix_lens,
|
||||
@@ -1165,15 +1181,6 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin, Duplex
|
||||
input_ids_buffer=self.input_ids.gpu[:num_tokens_padded],
|
||||
)
|
||||
|
||||
# Set cudagraph mode to none if calc_kv_scales is true.
|
||||
# KV scales calculation involves dynamic operations that are incompatible
|
||||
# with CUDA graph capture.
|
||||
if self.calculate_kv_scales:
|
||||
cudagraph_mode = CUDAGraphMode.NONE
|
||||
runner_assisted_full_attn = False
|
||||
# Mark KV scales as calculated after the first forward pass
|
||||
self.calculate_kv_scales = False
|
||||
|
||||
runner_assisted_context_enabled = False
|
||||
if runner_assisted_full_attn:
|
||||
runner_assisted_context_enabled = self._set_runner_assisted_full_attention_metadata_context(
|
||||
@@ -2101,6 +2108,7 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin, Duplex
|
||||
with record_function_or_nullcontext("gpu_model_runner: bookkeep"):
|
||||
(
|
||||
num_nans_in_logits,
|
||||
num_nans,
|
||||
logprobs_lists,
|
||||
valid_sampled_token_ids,
|
||||
prompt_logprobs_dict,
|
||||
@@ -2218,6 +2226,7 @@ class GPUARModelRunner(OmniGPUModelRunner, OmniConnectorModelRunnerMixin, Duplex
|
||||
invalid_req_indices=invalid_req_indices,
|
||||
async_output_copy_stream=self.async_output_copy_stream,
|
||||
vocab_size=self.input_batch.vocab_size,
|
||||
num_nans=num_nans,
|
||||
)
|
||||
if use_async_omni_output:
|
||||
async_output = async_output_cls(
|
||||
|
||||
Reference in new issue
Block a user