Skip to content

Commit 801a6b4

Browse files
[Misc] upgrade vLLM to a30addc (vllm-project#10459)
### What this PR does / why we need it? This PR updates vLLM-Ascend for the vLLM main upgrade: - Previous vLLM main: [`dc68bd8c4199b00631fe71eb37313f406cc66ac1`](vllm-project/vllm@dc68bd8) - New vLLM main: [`a30addc7548a9a8b9b3323a7bc3eb7d7c4895d1c`](vllm-project/vllm@a30addc) - Upstream compare: [`dc68bd8c...a30addc`](vllm-project/vllm@dc68bd8...a30addc) The final patch changes 6 files. The mapping below explains why each changed file is needed and which upstream vLLM PR/commit in this upgrade range caused it. #### `tests/e2e/pull_request/one_card/spec_decode/test_extract_hidden_states.py` - Upstream source: [vLLM #43805](https://github.com/vllm-project/vllm/pull/43805/changes#diff-72eec9c1ef7542e20f0c2610fd9e255959d9574e45321b0c2c8996301599a90fR287). - What changed upstream: `ExampleHiddenStatesConnector` was refactored to save hidden states asynchronously, pre-create `.lock` files, and expose connector helpers such as `load_hidden_states()` / `cleanup_hidden_states()` as the synchronized read path. - Local change: replace direct `safe_open(hidden_states_path, "pt")` reads with `example_hidden_states_connector.load_hidden_states(hidden_states_path)`, then read `hidden_states` and `token_ids` from the returned object. For vLLM main, cleanup is performed through `cleanup_hidden_states()` after the read; the v0.23.0 path keeps the existing existence check for release compatibility. - Why: after upstream async writes, the output path can be visible before the safetensors write has completed. Reading the file directly can race the writer. The connector helper respects the upstream lock protocol and avoids flaky hidden-state extraction tests. #### `tests/ut/patch/platform/test_patch_tool_choice_none_content.py` - Upstream source: [vLLM #45190](https://github.com/vllm-project/vllm/pull/45190/changes#diff-42bfc2c85e7e8c3e45317685ea1cd396c6f617a5eee3540d9b8758b8b06d60d6). - What changed upstream: Responses API parsing was unified to use `parser.parse()`, and the old `DelegatingParser._parse_tool_calls()` helper was removed. The current hook is `DelegatingParser._extract_tool_calls(content=..., request=..., enable_auto_tools=...)`. - Local change: update the unit test to call `_extract_tool_calls()` with the current argument order. - Why: the Ascend patch for forced tool-choice requests with `content=None` is applied to the current upstream hook. The test must exercise the method that is actually used by vLLM main; otherwise it either fails with `AttributeError` or no longer verifies the live parser path. #### `vllm_ascend/ops/fused_moe/fused_moe.py` - Upstream source: the routed-expert weight-loading fixes in [vLLM #45054](vllm-project/vllm#45054), commit [`f4966f8b3ddf757c607d57d4bb35624e2ee4f6b4`](vllm-project/vllm@f4966f8), and [vLLM #45067](vllm-project/vllm#45067), commit [`7920ccb97c2d27d0a1a822e42d11ba369c2f255c`](vllm-project/vllm@7920ccb). These are follow-up fixes to the earlier fused-MoE routed-expert refactor. - What changed upstream: vLLM moved model-specific loading paths to the new `experts.routed_experts.*` / `mlp.experts.routed_experts.*` parameter ownership. #45054 updates Aria, Qwen3-VL-MoE, Step3, Step3.5, and related quant loading paths. #45067 updates GPT-OSS legacy checkpoint name remapping after the fused-MoE refactor. - Local change: import `FusedMoE` and `MoERunner` from `vllm.model_executor.layers.fused_moe.layer` at module scope, while leaving only `UnquantizedFusedMoEMethod` under the v0.23.0/main version branch. Also narrow `_needs_routed_expert_parameter_aliases()` from the broad local list of model types to `model_type == "gpt_oss"`. - Why: the broad alias workaround was needed while upstream model loaders still looked for expert weights on the old MoE module path. In this vLLM range, upstream fixed the affected model loaders to use `routed_experts` directly, so keeping aliases for Aria/Qwen3/Step3/etc. would preserve stale duplicate parameter names. The remaining local alias path is kept only for the Ascend GPT-OSS compatibility case, while the import cleanup follows the current main package shape and keeps the release/main `UnquantizedFusedMoEMethod` path difference explicit. #### `vllm_ascend/worker/v2/attn_utils.py` - Upstream source: [vLLM #44586](https://github.com/vllm-project/vllm/pull/44586/changes#diff-9b864c13232e1f03b906ccc83311fa78d1c37988616ae88b4afdbb5c0d186a75R397). - What changed upstream: GPU `build_attn_metadata()` gained a `causal: bool = True` argument and passes it into `CommonAttentionMetadata(causal=causal)`. - Local change: add the same `causal` keyword to Ascend `build_attn_metadata()` and pass it through to `AscendCommonAttentionMetadata`. - Why: vLLM main can now call `build_attn_metadata(..., causal=...)`, especially from newer speculative decoding paths. Ascend must accept the same keyword to avoid `unexpected keyword argument 'causal'`, and must preserve `causal=False` instead of silently forcing all metadata to causal attention. #### `vllm_ascend/worker/v2/model_runner.py` - Upstream source: [vLLM #45163](https://github.com/vllm-project/vllm/pull/45163/changes#diff-5823f988fc0264681a80db24ccaba4d364f14394815d83ec1d90944c09f571f0L266). - What changed upstream: `GPUModelRunner.__init__` removed the early instance-attribute assignment `self.decode_query_len = self.num_speculative_steps + 1`. `self.decode_query_len` is now created later in `load_model()` after `model_state` exists, using `self.num_speculative_steps + self.model_state.num_new_sampled_tokens_per_step`. - Local change: in `NPUModelRunner.__init__`, replace the early read of `self.decode_query_len` with a local variable `decode_query_len = self.num_speculative_steps + 1` only for the immediate Ascend setup calls `set_cos_and_sin()` and `set_mc2_tokens_capacity()`. This does not reintroduce `self.decode_query_len` assignment in `__init__`. - Why: Ascend runs these setup calls immediately after `GPUModelRunner.__init__`, at a point where upstream main no longer has `self.decode_query_len` yet. The local value is a compatibility fallback matching the pre-#45163 formula for the currently supported Ascend path, while leaving upstream's later `self.decode_query_len` initialization model intact. #### Does this PR introduce _any_ user-facing change? No intended user-facing API change. This is a compatibility update for the new vLLM main baseline. It fixes test/runtime compatibility with upstream parser, connector, attention metadata, model runner, and fused-MoE loading changes. ### How was this patch tested? - CI: https://github.com/vllm-project/vllm-ascend/actions/runs/27770885645 Compatibility targets: - vLLM version: v0.23.0 - vLLM main: vllm-project/vllm@dc68bd8 --------- Signed-off-by: zhangxinyuehfad <starmoon_zhang@163.com> Signed-off-by: MrZ20 <2609716663@qq.com> Co-authored-by: zhangxinyuehfad <starmoon_zhang@163.com>
1 parent 52da9d9 commit 801a6b4

7 files changed

Lines changed: 40 additions & 39 deletions

File tree

.github/vllm-main-verified.commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dc68bd8c4199b00631fe71eb37313f406cc66ac1
1+
a30addc7548a9a8b9b3323a7bc3eb7d7c4895d1c

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-r requirements-lint.txt
22
-r requirements.txt
3-
modelscope>=1.35.1
3+
modelscope==1.35.3
44
openai
55
pytest >= 6.0,<9.0.0
66
pytest-asyncio

tests/e2e/pull_request/one_card/spec_decode/test_extract_hidden_states.py

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@
3333

3434
import pytest
3535
import torch
36-
from safetensors import safe_open
3736
from vllm import LLM, SamplingParams
3837

38+
from vllm_ascend.utils import vllm_version_is
39+
40+
if vllm_version_is("0.23.0"):
41+
from safetensors import safe_open
42+
else:
43+
from vllm.distributed.kv_transfer.kv_connector.v1 import example_hidden_states_connector
44+
45+
3946
os.environ["VLLM_WORKER_MULTIPROC_METHOD"] = "spawn"
4047

4148
DENSE_MODEL = "Qwen/Qwen3-8B"
@@ -123,16 +130,29 @@ def _verify_output(output, expected_shape, *, verify_nonzero, verify_token_ids):
123130
assert output.kv_transfer_params is not None
124131
hidden_states_path = output.kv_transfer_params.get("hidden_states_path")
125132
assert hidden_states_path is not None
126-
assert os.path.exists(hidden_states_path)
127133

128-
with safe_open(hidden_states_path, "pt") as f:
129-
tensor_names = f.keys()
130-
assert "hidden_states" in tensor_names
131-
hidden_states = f.get_tensor("hidden_states")
134+
if vllm_version_is("0.23.0"):
135+
assert os.path.exists(hidden_states_path)
136+
with safe_open(hidden_states_path, "pt") as f:
137+
tensor_names = f.keys()
138+
assert "hidden_states" in tensor_names
139+
hidden_states = f.get_tensor("hidden_states")
140+
assert hidden_states.shape == expected_shape
141+
142+
if verify_token_ids:
143+
token_ids = f.get_tensor("token_ids")
144+
assert torch.equal(token_ids, torch.tensor(output.prompt_token_ids))
145+
146+
if verify_nonzero:
147+
assert not torch.allclose(hidden_states, torch.zeros_like(hidden_states))
148+
else:
149+
obj = example_hidden_states_connector.load_hidden_states(hidden_states_path)
150+
example_hidden_states_connector.cleanup_hidden_states(hidden_states_path)
151+
hidden_states = obj["hidden_states"]
132152
assert hidden_states.shape == expected_shape
133153

134154
if verify_token_ids:
135-
token_ids = f.get_tensor("token_ids")
155+
token_ids = obj["token_ids"]
136156
assert torch.equal(token_ids, torch.tensor(output.prompt_token_ids))
137157

138158
if verify_nonzero:

tests/ut/patch/platform/test_patch_tool_choice_none_content.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def test_responses_parser_allows_named_tool_choice_with_none_content():
6565
)
6666
parser = _DummyDelegatingParser(tokenizer=None)
6767

68-
tool_calls, content = parser._parse_tool_calls(
69-
request=request,
68+
tool_calls, content = parser._extract_tool_calls(
7069
content=None,
70+
request=request,
7171
enable_auto_tools=False,
7272
)
7373

vllm_ascend/ops/fused_moe/fused_moe.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
from vllm.forward_context import get_forward_context
2828
from vllm.logger import logger
2929
from vllm.model_executor.layers.fused_moe.config import FusedMoEConfig
30+
from vllm.model_executor.layers.fused_moe.layer import (
31+
FusedMoE, # noqa: F401
32+
MoERunner,
33+
)
3034

3135
from vllm_ascend.ascend_config import get_ascend_config
3236
from vllm_ascend.ascend_forward_context import _EXTRA_CTX, MoECommType
@@ -49,12 +53,8 @@
4953
)
5054

5155
if vllm_version_is("0.23.0"):
52-
from vllm.model_executor.layers.fused_moe.layer import FusedMoE, UnquantizedFusedMoEMethod # noqa: F401
53-
from vllm.model_executor.layers.fused_moe.runner.moe_runner import MoERunner # type: ignore
56+
from vllm.model_executor.layers.fused_moe.layer import UnquantizedFusedMoEMethod
5457
else:
55-
from vllm.model_executor.layers.fused_moe.layer import (
56-
MoERunner,
57-
)
5858
from vllm.model_executor.layers.fused_moe.unquantized_fused_moe_method import UnquantizedFusedMoEMethod
5959

6060

@@ -515,31 +515,9 @@ def wrapped_process_weights(layer, *args, **kwargs):
515515
self._quant_method.process_weights_after_loading = wrapped_process_weights # type: ignore[method-assign]
516516

517517
def _needs_routed_expert_parameter_aliases(self) -> bool:
518-
# test_gpt_oss_distributed_tp2
519-
# test_qwen3_moe_routing_replay[Qwen/Qwen3.5-35B-A3B]
520-
# test_multimodal_reasoning_pp_full_decode_only
521518
vllm_config = get_current_vllm_config()
522519
hf_config = getattr(vllm_config.model_config, "hf_config", None)
523-
model_type = getattr(hf_config, "model_type", None)
524-
architectures = getattr(hf_config, "architectures", ()) or ()
525-
if model_type in {"qwen3_5_mtp", "step3p5_mtp"} or set(architectures) & {
526-
"Qwen3_5MoeMTP",
527-
"Step3p5MTP",
528-
}:
529-
return False
530-
if self.layer_name.startswith("mtp.") or ".mtp." in self.layer_name:
531-
return False
532-
return model_type in {
533-
"aria",
534-
"aria_text",
535-
"gpt_oss",
536-
"qwen3_5_moe",
537-
"qwen3_vl_moe",
538-
"qwen3_vl_moe_text",
539-
"step3_text",
540-
"step3_vl",
541-
"step3p5",
542-
}
520+
return getattr(hf_config, "model_type", None) == "gpt_oss"
543521

544522
@property
545523
def is_internal_router(self) -> bool:

vllm_ascend/worker/v2/attn_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def build_attn_metadata(
115115
prefill_context_parallel_metadata: AscendPrefillContextParallelMetadata | None = None,
116116
model_specific_attn_metadata: ModelSpecificAttnMetadata | None = None,
117117
for_cudagraph_capture: bool = False,
118+
causal: bool = True,
118119
) -> dict[str, Any]:
119120
"""Build attention metadata for Ascend NPUs."""
120121
# TODO(Ronald1995): optimize AscendCommonAttentionMetadata.
@@ -154,6 +155,7 @@ def build_attn_metadata(
154155
num_input_tokens=num_input_tokens,
155156
prefill_context_parallel_metadata=prefill_context_parallel_metadata,
156157
max_seq_len=max_seq_len,
158+
causal=causal,
157159
**common_attn_metadata_extra_kwargs,
158160
)
159161

vllm_ascend/worker/v2/model_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def __init__(self, vllm_config: VllmConfig, device: torch.device):
123123
# is necessary for weight_prfetching function, and MoE communication optimization.
124124
set_weight_prefetch_method(self.ascend_config.weight_prefetch_config)
125125
# TODO: remove set_cos_and_sin (together with update_cos_sin) when mla can properly handle cos/sin internally
126+
self.decode_query_len = self.num_speculative_steps + 1
126127
set_cos_and_sin(vllm_config, self.max_num_reqs, self.decode_query_len, self.dtype, self.device)
127128
set_mc2_tokens_capacity(vllm_config, self.max_num_reqs, self.decode_query_len)
128129
set_mc2_mask(vllm_config, self.device)

0 commit comments

Comments
 (0)