diff --git a/docker/Dockerfile.npu b/docker/Dockerfile.npu index 0d91c0b32..f83cc512a 100644 --- a/docker/Dockerfile.npu +++ b/docker/Dockerfile.npu @@ -1,5 +1,5 @@ ARG VLLM_ASCEND_IMAGE=quay.io/atlas-ci/vllm-ascend -ARG VLLM_ASCEND_VERSION=v0.28.0 +ARG VLLM_ASCEND_VERSION=v0.29.0 ARG VLLM_ASCEND_DEVICE_SUFFIX= FROM ${VLLM_ASCEND_IMAGE}:${VLLM_ASCEND_VERSION}${VLLM_ASCEND_DEVICE_SUFFIX} diff --git a/docker/Dockerfile.npu.ci b/docker/Dockerfile.npu.ci index 0a150fdd8..b65b803d6 100644 --- a/docker/Dockerfile.npu.ci +++ b/docker/Dockerfile.npu.ci @@ -1,5 +1,5 @@ ARG VLLM_ASCEND_IMAGE=quay.io/atlas-ci/vllm-ascend -ARG VLLM_ASCEND_VERSION=v0.28.0 +ARG VLLM_ASCEND_VERSION=v0.29.0 ARG VLLM_ASCEND_DEVICE_SUFFIX= FROM ${VLLM_ASCEND_IMAGE}:${VLLM_ASCEND_VERSION}${VLLM_ASCEND_DEVICE_SUFFIX} diff --git a/docs/getting_started/installation/npu/npu.inc.md b/docs/getting_started/installation/npu/npu.inc.md index 9ff477522..21127caf2 100644 --- a/docs/getting_started/installation/npu/npu.inc.md +++ b/docs/getting_started/installation/npu/npu.inc.md @@ -10,25 +10,25 @@ The recommended way to use vLLM-Omni on NPU is through the vLLM-Ascend pre-built === "A2" ```bash - export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.28.0 + export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.29.0 ``` === "A3" ```bash - export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.28.0-a3 + export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.29.0-a3 ``` === "A5" ```bash - export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.28.0-a5 + export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.29.0-a5 ``` === "310P (Experimental)" ```bash - export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.28.0-310p + export IMAGE=quay.io/atlas-ci/vllm-ascend:v0.29.0-310p ``` ```bash @@ -53,7 +53,7 @@ docker run --rm \ # Inside the container, install vLLM-Omni from source cd /vllm-workspace -git clone -b v0.28.0 https://github.com/vllm-project/vllm-omni.git +git clone -b v0.29.0rc1 https://github.com/vllm-project/vllm-omni.git cd vllm-omni pip install -v -e . --no-build-isolation # or VLLM_OMNI_TARGET_DEVICE=npu pip install -v -e . @@ -71,10 +71,10 @@ We are keeping [issue #886](https://github.com/vllm-project/vllm-omni/issues/886 # --8<-- [start:installation-main] -You can also install vLLM-Omni from the latest main branch if you want to use the latest features or bug fixes. Use the aligned vLLM-Ascend v0.28.0 image described above, and check [issue #886](https://github.com/vllm-project/vllm-omni/issues/886) for the status of the latest vLLM-Omni commit on NPU. +You can also install vLLM-Omni from the latest main branch if you want to use the latest features or bug fixes. Use the aligned vLLM-Ascend v0.29.0 image described above, and check [issue #886](https://github.com/vllm-project/vllm-omni/issues/886) for the status of the latest vLLM-Omni commit on NPU. ```bash -# Inside the vLLM-Ascend v0.28.0 container, install vLLM-Omni from main +# Inside the vLLM-Ascend v0.29.0 container, install vLLM-Omni from main cd /vllm-workspace git clone https://github.com/vllm-project/vllm-omni.git cd vllm-omni @@ -103,7 +103,7 @@ Here's an example deployment command that has been verified on 4 x NPUs: === "A2" ```bash - export IMAGE=quay.io/ascend/vllm-omni:v0.28.0 + export IMAGE=quay.io/ascend/vllm-omni:v0.29.0 docker run --rm \ --name vllm-omni-a2 \ --shm-size=64g \ @@ -127,7 +127,7 @@ Here's an example deployment command that has been verified on 4 x NPUs: === "A3" ```bash - export IMAGE=quay.io/ascend/vllm-omni:v0.28.0-a3 + export IMAGE=quay.io/ascend/vllm-omni:v0.29.0-a3 docker run --rm \ --name vllm-omni-a3 \ --shm-size=64g \ @@ -151,7 +151,7 @@ Here's an example deployment command that has been verified on 4 x NPUs: === "A5" ```bash - export IMAGE=quay.io/ascend/vllm-omni:v0.28.0-a5 + export IMAGE=quay.io/ascend/vllm-omni:v0.29.0-a5 docker run --rm \ --name vllm-omni-a5 \ --shm-size=64g \ @@ -175,7 +175,7 @@ Here's an example deployment command that has been verified on 4 x NPUs: === "310P (Experimental)" ```bash - export IMAGE=quay.io/ascend/vllm-omni:v0.28.0-310p + export IMAGE=quay.io/ascend/vllm-omni:v0.29.0-310p docker run --rm \ --name vllm-omni-310p \ --shm-size=64g \ diff --git a/vllm_omni/platforms/npu/worker/npu_ar_model_runner.py b/vllm_omni/platforms/npu/worker/npu_ar_model_runner.py index 734178e01..7bc6c21c6 100644 --- a/vllm_omni/platforms/npu/worker/npu_ar_model_runner.py +++ b/vllm_omni/platforms/npu/worker/npu_ar_model_runner.py @@ -334,6 +334,8 @@ class NPUARModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin, Duplex if not isinstance(info, dict): return None val = info.get("omni_final_stage_id") + if val is None: + return None try: return int(val) except (TypeError, ValueError): @@ -512,7 +514,7 @@ class NPUARModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin, Duplex # returns True. before returning early here we call # dummy run to ensure coordinate_batch_across_dp # is called into to avoid out of sync issues. - self._dummy_run(1) + self._dummy_run(1, skip_gdn_state_update=True) kv_ids = self.kv_extracted_req_ids self.kv_extracted_req_ids = None @@ -1035,6 +1037,8 @@ class NPUARModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin, Duplex propose_draft_token_ids(sampler_output.sampled_token_ids) ( + num_nans_in_logits, + num_nans_device, logprobs_lists, valid_sampled_token_ids, prompt_logprobs_dict, @@ -1278,6 +1282,7 @@ class NPUARModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin, Duplex kv_connector_output=kv_connector_output, ec_connector_output=ec_connector_output if self.supports_mm_inputs else None, cudagraph_stats=cudagraph_stats, + num_nans_in_logits=num_nans_in_logits, ) model_runner_output.kv_extracted_req_ids = kv_extracted_req_ids model_runner_output.routed_experts = routed_experts_lists @@ -1318,6 +1323,7 @@ class NPUARModelRunner(OmniNPUModelRunner, 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_device, ) self.input_batch.set_async_sampled_token_ids( async_output.sampled_token_ids_cpu, diff --git a/vllm_omni/platforms/npu/worker/npu_generation_model_runner.py b/vllm_omni/platforms/npu/worker/npu_generation_model_runner.py index fc26882cd..59dfc88a3 100644 --- a/vllm_omni/platforms/npu/worker/npu_generation_model_runner.py +++ b/vllm_omni/platforms/npu/worker/npu_generation_model_runner.py @@ -166,7 +166,7 @@ class NPUGenerationModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin # returns True. before returning early here we call # dummy run to ensure coordinate_batch_across_dp # is called into to avoid out of sync issues. - self._dummy_run(1) + self._dummy_run(1, skip_gdn_state_update=True) if not has_kv_transfer_group(): # Return empty ModelRunnerOutput if no work to do. return self.attach_omni_connector_output(EMPTY_MODEL_RUNNER_OUTPUT) @@ -636,6 +636,7 @@ class NPUGenerationModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin profile_seq_lens: int | None = None, profile_cpp: bool = False, randomize_inputs: bool = False, + skip_gdn_state_update: bool = False, ) -> tuple[torch.Tensor, torch.Tensor]: # only support eager mode and piecewise graph now assert cudagraph_runtime_mode is None or cudagraph_runtime_mode.is_valid_runtime_mode() @@ -768,7 +769,10 @@ class NPUGenerationModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin self.query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens self.query_start_loc.copy_to_gpu() if self._has_gdn: - self.gdn_query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens + if skip_gdn_state_update: + self.gdn_query_start_loc.np.fill(0) + else: + self.gdn_query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens self.gdn_query_start_loc.copy_to_gpu() if not profile_cpp: @@ -786,6 +790,12 @@ class NPUGenerationModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin # rows as well so device-side metadata does not see stale block ids. self.input_batch.block_table.commit_block_table(num_reqs_padded) + # Invalidate slots before backends copy metadata for dummy execution. + if not is_graph_capturing: + for kv_cache_gid in range(len(self.kv_cache_config.kv_cache_groups)): + blk_table = self.input_batch.block_table[kv_cache_gid] + blk_table.slot_mapping.gpu.fill_(-1) + pad_attn = cudagraph_runtime_mode == CUDAGraphMode.FULL attn_metadata, _ = self._build_attention_metadata( num_tokens=num_tokens_unpadded, @@ -796,11 +806,10 @@ class NPUGenerationModelRunner(OmniNPUModelRunner, OmniConnectorModelRunnerMixin ubatch_slices=ubatch_slices_padded if pad_attn else ubatch_slices, for_cudagraph_capture=is_graph_capturing, num_scheduled_tokens_np=num_scheduled_tokens, + cudagraph_runtime_mode=cudagraph_runtime_mode, + batch_descriptor=batch_desc, + skip_gdn_state_update=skip_gdn_state_update, ) - if not is_graph_capturing: - for kv_cache_gid in range(len(self.kv_cache_config.kv_cache_groups)): - blk_table = self.input_batch.block_table[kv_cache_gid] - blk_table.slot_mapping.gpu.fill_(-1) with self.maybe_dummy_run_with_lora( self.lora_config, diff --git a/vllm_omni/platforms/npu/worker/npu_model_runner.py b/vllm_omni/platforms/npu/worker/npu_model_runner.py index 8f0369808..bd7c7dce4 100644 --- a/vllm_omni/platforms/npu/worker/npu_model_runner.py +++ b/vllm_omni/platforms/npu/worker/npu_model_runner.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project +# SPDX-FileCopyrightText: Copyright contributors to the vLLM-Omni project from functools import partial from typing import Any @@ -126,6 +126,7 @@ class OmniNPUModelRunner(OmniGPUModelRunner, NPUModelRunner): profile_seq_lens: int | None = None, profile_cpp: bool = False, randomize_inputs: bool = False, + skip_gdn_state_update: bool = False, ) -> tuple[torch.Tensor, torch.Tensor]: # only support eager mode and piecewise graph now assert cudagraph_runtime_mode is None or cudagraph_runtime_mode.is_valid_runtime_mode() @@ -257,7 +258,10 @@ class OmniNPUModelRunner(OmniGPUModelRunner, NPUModelRunner): self.query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens self.query_start_loc.copy_to_gpu() if self._has_gdn: - self.gdn_query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens + if skip_gdn_state_update: + self.gdn_query_start_loc.np.fill(0) + else: + self.gdn_query_start_loc.np[1 : num_reqs_padded + 1] = cum_num_tokens self.gdn_query_start_loc.copy_to_gpu() if not profile_cpp: @@ -275,6 +279,12 @@ class OmniNPUModelRunner(OmniGPUModelRunner, NPUModelRunner): # rows as well so device-side metadata does not see stale block ids. self.input_batch.block_table.commit_block_table(num_reqs_padded) + # Invalidate slots before backends copy metadata for dummy execution. + if not is_graph_capturing: + for kv_cache_gid in range(len(self.kv_cache_config.kv_cache_groups)): + blk_table = self.input_batch.block_table[kv_cache_gid] + blk_table.slot_mapping.gpu.fill_(-1) + pad_attn = cudagraph_runtime_mode == CUDAGraphMode.FULL attn_metadata, _ = self._build_attention_metadata( num_tokens=num_tokens_unpadded, @@ -285,11 +295,10 @@ class OmniNPUModelRunner(OmniGPUModelRunner, NPUModelRunner): ubatch_slices=ubatch_slices_padded if pad_attn else ubatch_slices, for_cudagraph_capture=is_graph_capturing, num_scheduled_tokens_np=num_scheduled_tokens, + cudagraph_runtime_mode=cudagraph_runtime_mode, + batch_descriptor=batch_desc, + skip_gdn_state_update=skip_gdn_state_update, ) - if not is_graph_capturing: - for kv_cache_gid in range(len(self.kv_cache_config.kv_cache_groups)): - blk_table = self.input_batch.block_table[kv_cache_gid] - blk_table.slot_mapping.gpu.fill_(-1) with self.maybe_dummy_run_with_lora( self.lora_config,