[Main2Main] Upgrade vLLM to 0226 (#6813)
### What this PR does / why we need it?
Breaking:
1. https://github.com/vllm-project/vllm/pull/33452
2. https://github.com/vllm-project/vllm/pull/33451
3. https://github.com/vllm-project/vllm/pull/32567
4. https://github.com/vllm-project/vllm/pull/32344
### Does this PR introduce _any_ user-facing change?
### How was this patch tested?
- vLLM version: v0.15.0
- vLLM main:
83b47f67b1
---------
Signed-off-by: MrZ20 <2609716663@qq.com>
Signed-off-by: gcanlin <canlinguosdu@gmail.com>
Co-authored-by: MrZ20 <2609716663@qq.com>
This commit is contained in:
@@ -32,7 +32,7 @@ on:
|
|||||||
description: how many pods will be pulled up via lws.yaml, indicates number of nodes we need
|
description: how many pods will be pulled up via lws.yaml, indicates number of nodes we need
|
||||||
vllm_version:
|
vllm_version:
|
||||||
required: false
|
required: false
|
||||||
default: "v0.15.0"
|
default: "v0.16.0"
|
||||||
type: string
|
type: string
|
||||||
description: vllm version to use
|
description: vllm version to use
|
||||||
vllm_ascend_remote_url:
|
vllm_ascend_remote_url:
|
||||||
|
|||||||
2
.github/workflows/bot_pr_create.yaml
vendored
2
.github/workflows/bot_pr_create.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Get vLLM version
|
- name: Get vLLM version
|
||||||
run: |
|
run: |
|
||||||
VLLM_COMMIT=83b47f67b1dfad505606070ae4d9f83e50ad4ebd
|
VLLM_COMMIT=15d76f74e2fdb12a95ea00f0ca283acf6219a2b7
|
||||||
echo "VLLM_COMMIT=https://github.com/vllm-project/vllm/commit/$VLLM_COMMIT" >> "$GITHUB_ENV"
|
echo "VLLM_COMMIT=https://github.com/vllm-project/vllm/commit/$VLLM_COMMIT" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ RUN apt-get update -y && \
|
|||||||
|
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
# For lint purpose, actually we need make a main2main matching.
|
# For lint purpose, actually we need make a main2main matching.
|
||||||
ARG VLLM_COMMIT=83b47f67b1dfad505606070ae4d9f83e50ad4ebd
|
ARG VLLM_COMMIT=15d76f74e2fdb12a95ea00f0ca283acf6219a2b7
|
||||||
RUN git clone $VLLM_REPO /vllm-workspace/vllm && \
|
RUN git clone $VLLM_REPO /vllm-workspace/vllm && \
|
||||||
cd /vllm-workspace/vllm && \
|
cd /vllm-workspace/vllm && \
|
||||||
git checkout $VLLM_COMMIT
|
git checkout $VLLM_COMMIT
|
||||||
|
|||||||
2
.github/workflows/pr_test_full.yaml
vendored
2
.github/workflows/pr_test_full.yaml
vendored
@@ -75,7 +75,7 @@ jobs:
|
|||||||
name: e2e-full
|
name: e2e-full
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
vllm_version: [83b47f67b1dfad505606070ae4d9f83e50ad4ebd, v0.15.0]
|
vllm_version: [15d76f74e2fdb12a95ea00f0ca283acf6219a2b7, v0.16.0]
|
||||||
needs: [changes]
|
needs: [changes]
|
||||||
if: ${{ needs.changes.outputs.e2e_tracker == 'true' || needs.changes.outputs.e2e_tracker == true }}
|
if: ${{ needs.changes.outputs.e2e_tracker == 'true' || needs.changes.outputs.e2e_tracker == true }}
|
||||||
uses: ./.github/workflows/_e2e_test.yaml
|
uses: ./.github/workflows/_e2e_test.yaml
|
||||||
|
|||||||
6
.github/workflows/pr_test_light.yaml
vendored
6
.github/workflows/pr_test_light.yaml
vendored
@@ -41,7 +41,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
uses: ./.github/workflows/_pre_commit.yml
|
uses: ./.github/workflows/_pre_commit.yml
|
||||||
with:
|
with:
|
||||||
vllm: 83b47f67b1dfad505606070ae4d9f83e50ad4ebd
|
vllm: 15d76f74e2fdb12a95ea00f0ca283acf6219a2b7
|
||||||
changes:
|
changes:
|
||||||
runs-on: linux-aarch64-a2b3-0
|
runs-on: linux-aarch64-a2b3-0
|
||||||
outputs:
|
outputs:
|
||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
if: ${{ needs.lint.result == 'success' && (needs.changes.outputs.e2e_tracker == 'true' || needs.changes.outputs.ut_tracker == 'true') }}
|
if: ${{ needs.lint.result == 'success' && (needs.changes.outputs.e2e_tracker == 'true' || needs.changes.outputs.ut_tracker == 'true') }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
vllm_version: [83b47f67b1dfad505606070ae4d9f83e50ad4ebd, v0.15.0]
|
vllm_version: [15d76f74e2fdb12a95ea00f0ca283acf6219a2b7, v0.16.0]
|
||||||
uses: ./.github/workflows/_unit_test.yaml
|
uses: ./.github/workflows/_unit_test.yaml
|
||||||
with:
|
with:
|
||||||
vllm: ${{ matrix.vllm_version }}
|
vllm: ${{ matrix.vllm_version }}
|
||||||
@@ -99,7 +99,7 @@ jobs:
|
|||||||
name: e2e-light
|
name: e2e-light
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
vllm_version: [83b47f67b1dfad505606070ae4d9f83e50ad4ebd, v0.15.0]
|
vllm_version: [15d76f74e2fdb12a95ea00f0ca283acf6219a2b7, v0.16.0]
|
||||||
# Note (yikun): If CI resource are limited we can split job into two chain jobs
|
# Note (yikun): If CI resource are limited we can split job into two chain jobs
|
||||||
needs: [lint, changes]
|
needs: [lint, changes]
|
||||||
# only trigger e2e test after lint passed and the change is e2e related with pull request.
|
# only trigger e2e test after lint passed and the change is e2e related with pull request.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ jobs:
|
|||||||
name: refresh codecov
|
name: refresh codecov
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
vllm_version: [83b47f67b1dfad505606070ae4d9f83e50ad4ebd]
|
vllm_version: [15d76f74e2fdb12a95ea00f0ca283acf6219a2b7]
|
||||||
uses: ./.github/workflows/_unit_test.yaml
|
uses: ./.github/workflows/_unit_test.yaml
|
||||||
with:
|
with:
|
||||||
vllm: ${{ matrix.vllm_version }}
|
vllm: ${{ matrix.vllm_version }}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ jobs:
|
|||||||
- Qwen3-Omni-30B-A3B-Instruct
|
- Qwen3-Omni-30B-A3B-Instruct
|
||||||
uses: ./.github/workflows/_e2e_nightly_single_node_models.yaml
|
uses: ./.github/workflows/_e2e_nightly_single_node_models.yaml
|
||||||
with:
|
with:
|
||||||
vllm: v0.15.0
|
vllm: v0.16.0
|
||||||
runner: ${{ matrix.test_config.os }}
|
runner: ${{ matrix.test_config.os }}
|
||||||
model_list: ${{ toJson(matrix.test_config.model_list) }}
|
model_list: ${{ toJson(matrix.test_config.model_list) }}
|
||||||
image: 'swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-910b-ubuntu22.04-py3.11'
|
image: 'swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-910b-ubuntu22.04-py3.11'
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- vllm_branch: v0.15.0
|
- vllm_branch: v0.16.0
|
||||||
vllm_ascend_branch: main
|
vllm_ascend_branch: main
|
||||||
max-parallel: 1
|
max-parallel: 1
|
||||||
container:
|
container:
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ RUN pip config set global.index-url ${PIP_INDEX_URL}
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ RUN pip config set global.index-url ${PIP_INDEX_URL}
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ COPY . /vllm-workspace/vllm-ascend/
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ RUN apt-get update -y && \
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -v -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ RUN yum update -y && \
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ RUN yum update -y && \
|
|||||||
|
|
||||||
# Install vLLM
|
# Install vLLM
|
||||||
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
|
||||||
ARG VLLM_TAG=v0.15.0
|
ARG VLLM_TAG=v0.16.0
|
||||||
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /vllm-workspace/vllm
|
||||||
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
|
||||||
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /vllm-workspace/vllm/[audio] --extra-index https://download.pytorch.org/whl/cpu/ && \
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ For main branch of vLLM Ascend, we usually make it compatible with the latest vL
|
|||||||
|
|
||||||
| vLLM Ascend | vLLM | Python | Stable CANN | PyTorch/torch_npu |
|
| vLLM Ascend | vLLM | Python | Stable CANN | PyTorch/torch_npu |
|
||||||
|-------------|--------------|------------------|-------------|--------------------|
|
|-------------|--------------|------------------|-------------|--------------------|
|
||||||
| main | 83b47f67b1dfad505606070ae4d9f83e50ad4ebd, v0.15.0 tag | >= 3.10, < 3.12 | 8.5.0 | 2.9.0 / 2.9.0 |
|
| main | 4572a06afe96d0a6d5d3efacf130c71505dd2bc9, v0.16.0 tag | >= 3.10, < 3.12 | 8.5.0 | 2.9.0 / 2.9.0 |
|
||||||
|
|
||||||
## Release cadence
|
## Release cadence
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ myst_substitutions = {
|
|||||||
# CANN image tag
|
# CANN image tag
|
||||||
"cann_image_tag": "8.5.0-910b-ubuntu22.04-py3.11",
|
"cann_image_tag": "8.5.0-910b-ubuntu22.04-py3.11",
|
||||||
# vllm version in ci
|
# vllm version in ci
|
||||||
"ci_vllm_version": "v0.15.0",
|
"ci_vllm_version": "v0.16.0",
|
||||||
}
|
}
|
||||||
|
|
||||||
# For cross-file header anchors
|
# For cross-file header anchors
|
||||||
|
|||||||
@@ -20,15 +20,10 @@ from typing import Any
|
|||||||
|
|
||||||
import torch.fx as fx
|
import torch.fx as fx
|
||||||
from torch._inductor.decomposition import select_decomp_table
|
from torch._inductor.decomposition import select_decomp_table
|
||||||
|
from vllm.compilation.passes.fx_utils import OpOverload
|
||||||
from vllm.config import get_current_vllm_config
|
from vllm.config import get_current_vllm_config
|
||||||
|
|
||||||
from vllm_ascend.compilation.compiler_interface import compile_fx
|
from vllm_ascend.compilation.compiler_interface import compile_fx
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
from vllm.compilation.fx_utils import OpOverload # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.fx_utils import OpOverload
|
|
||||||
|
|
||||||
|
|
||||||
class TestBackend:
|
class TestBackend:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import pytest
|
|||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import vllm.config
|
import vllm.config
|
||||||
|
from vllm.compilation.passes.fx_utils import OpOverload
|
||||||
from vllm.config import ModelConfig, VllmConfig
|
from vllm.config import ModelConfig, VllmConfig
|
||||||
from vllm.distributed import ensure_model_parallel_initialized, init_distributed_environment
|
from vllm.distributed import ensure_model_parallel_initialized, init_distributed_environment
|
||||||
from vllm.utils.system_utils import update_environment_variables
|
from vllm.utils.system_utils import update_environment_variables
|
||||||
@@ -27,13 +28,7 @@ import vllm_ascend.ops.register_custom_ops # noqa
|
|||||||
from tests.e2e.singlecard.compile.backend import TestBackend
|
from tests.e2e.singlecard.compile.backend import TestBackend
|
||||||
from vllm_ascend.ascend_forward_context import set_ascend_forward_context
|
from vllm_ascend.ascend_forward_context import set_ascend_forward_context
|
||||||
from vllm_ascend.compilation.passes.norm_quant_fusion_pass import AddRMSNormQuantFusionPass
|
from vllm_ascend.compilation.passes.norm_quant_fusion_pass import AddRMSNormQuantFusionPass
|
||||||
from vllm_ascend.utils import enable_custom_op, vllm_version_is
|
from vllm_ascend.utils import enable_custom_op
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
from vllm.compilation.fx_utils import OpOverload # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.fx_utils import OpOverload
|
|
||||||
|
|
||||||
|
|
||||||
# Cache backend to avoid duplicate pattern registration
|
# Cache backend to avoid duplicate pattern registration
|
||||||
_backend_cache = None
|
_backend_cache = None
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ class TestAscendConfig(unittest.TestCase):
|
|||||||
"eplb_config": {"dynamic_eplb": True, "num_redundant_experts": 2},
|
"eplb_config": {"dynamic_eplb": True, "num_redundant_experts": 2},
|
||||||
}
|
}
|
||||||
from vllm.model_executor.layers.fused_moe.config import RoutingMethodType
|
from vllm.model_executor.layers.fused_moe.config import RoutingMethodType
|
||||||
if vllm_version_is("0.15.0"):
|
if vllm_version_is("0.16.0"):
|
||||||
moe_parallel_config = FusedMoEParallelConfig(
|
moe_parallel_config = FusedMoEParallelConfig(
|
||||||
2, 0, 1, 2, 1, 1, 1, 1, True, "hccl", enable_eplb=True)
|
2, 0, 1, 2, 1, 1, 1, 1, True, "hccl", is_sequence_parallel=True, enable_eplb=True)
|
||||||
moe_config = FusedMoEConfig(
|
moe_config = FusedMoEConfig(
|
||||||
num_experts=8,
|
num_experts=8,
|
||||||
experts_per_token=8,
|
experts_per_token=8,
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ from vllm_ascend.quantization.modelslim_config import (
|
|||||||
)
|
)
|
||||||
from vllm_ascend.utils import ASCEND_QUANTIZATION_METHOD, vllm_version_is
|
from vllm_ascend.utils import ASCEND_QUANTIZATION_METHOD, vllm_version_is
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
from vllm.model_executor.layers.attention import Attention
|
||||||
from vllm.attention.layer import Attention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import Attention
|
|
||||||
|
|
||||||
|
|
||||||
class TestAscendModelSlimConfig(TestBase):
|
class TestAscendModelSlimConfig(TestBase):
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ from vllm_ascend.utils import (
|
|||||||
is_drafter_moe_model,
|
is_drafter_moe_model,
|
||||||
is_moe_model,
|
is_moe_model,
|
||||||
speculative_enable_dispatch_gmm_combine_decode,
|
speculative_enable_dispatch_gmm_combine_decode,
|
||||||
vllm_version_is,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -152,10 +151,6 @@ def set_ascend_forward_context(
|
|||||||
mc2_mask[:num_actual_tokens] = True
|
mc2_mask[:num_actual_tokens] = True
|
||||||
mc2_mask[num_actual_tokens:] = False
|
mc2_mask[num_actual_tokens:] = False
|
||||||
forward_context.mc2_mask = mc2_mask
|
forward_context.mc2_mask = mc2_mask
|
||||||
|
|
||||||
if is_draft_model and vllm_version_is("0.15.0"):
|
|
||||||
forward_context.remaining_moe_layers = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
@@ -17,17 +17,10 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from torch import fx as fx
|
from torch import fx as fx
|
||||||
|
from vllm.compilation.passes.inductor_pass import get_pass_context
|
||||||
|
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
||||||
from vllm.config import VllmConfig
|
from vllm.config import VllmConfig
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
from vllm.compilation.inductor_pass import get_pass_context # type: ignore
|
|
||||||
from vllm.compilation.vllm_inductor_pass import VllmInductorPass # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.inductor_pass import get_pass_context
|
|
||||||
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
|
||||||
|
|
||||||
|
|
||||||
class GraphFusionPassManager:
|
class GraphFusionPassManager:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#
|
#
|
||||||
import torch
|
import torch
|
||||||
from torch._inductor.pattern_matcher import Match, PatternMatcherPass, PatternPrettyPrinter
|
from torch._inductor.pattern_matcher import Match, PatternMatcherPass, PatternPrettyPrinter
|
||||||
|
from vllm.compilation.passes.inductor_pass import get_pass_context
|
||||||
|
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
||||||
from vllm.config import VllmConfig
|
from vllm.config import VllmConfig
|
||||||
from vllm.config.compilation import Range
|
from vllm.config.compilation import Range
|
||||||
from vllm.distributed import get_tensor_model_parallel_world_size, tensor_model_parallel_all_reduce
|
from vllm.distributed import get_tensor_model_parallel_world_size, tensor_model_parallel_all_reduce
|
||||||
@@ -24,14 +26,6 @@ from vllm.logger import logger
|
|||||||
|
|
||||||
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
||||||
from vllm_ascend.compilation.passes.utils.npugraph_ex_utils_check import extra_stream_scope_check
|
from vllm_ascend.compilation.passes.utils.npugraph_ex_utils_check import extra_stream_scope_check
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
from vllm.compilation.inductor_pass import get_pass_context # type: ignore
|
|
||||||
from vllm.compilation.vllm_inductor_pass import VllmInductorPass # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.inductor_pass import get_pass_context
|
|
||||||
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
|
||||||
|
|
||||||
# computation-communication tiling block is 512
|
# computation-communication tiling block is 512
|
||||||
ALLREDUCE_NORM_FUSE_THRESHOLD = 512
|
ALLREDUCE_NORM_FUSE_THRESHOLD = 512
|
||||||
|
|||||||
@@ -17,17 +17,13 @@
|
|||||||
#
|
#
|
||||||
import torch
|
import torch
|
||||||
from torch._inductor.pattern_matcher import PatternMatcherPass
|
from torch._inductor.pattern_matcher import PatternMatcherPass
|
||||||
|
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
||||||
from vllm.config import VllmConfig
|
from vllm.config import VllmConfig
|
||||||
from vllm.config.compilation import Range
|
from vllm.config.compilation import Range
|
||||||
from vllm.logger import logger
|
from vllm.logger import logger
|
||||||
|
|
||||||
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
||||||
from vllm_ascend.utils import enable_custom_op, vllm_version_is
|
from vllm_ascend.utils import enable_custom_op
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
from vllm.compilation.vllm_inductor_pass import VllmInductorPass # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
|
||||||
|
|
||||||
|
|
||||||
class AddRMSNormQuantPattern(BasePattern):
|
class AddRMSNormQuantPattern(BasePattern):
|
||||||
|
|||||||
@@ -17,19 +17,13 @@
|
|||||||
#
|
#
|
||||||
import torch
|
import torch
|
||||||
from torch._inductor.pattern_matcher import PatternMatcherPass, PatternPrettyPrinter
|
from torch._inductor.pattern_matcher import PatternMatcherPass, PatternPrettyPrinter
|
||||||
|
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
||||||
from vllm.config import VllmConfig, get_layers_from_vllm_config
|
from vllm.config import VllmConfig, get_layers_from_vllm_config
|
||||||
from vllm.config.compilation import Range
|
from vllm.config.compilation import Range
|
||||||
from vllm.logger import logger
|
from vllm.logger import logger
|
||||||
|
from vllm.model_executor.layers.attention import Attention
|
||||||
|
|
||||||
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
from vllm_ascend.compilation.passes.base_pattern import BasePattern
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
|
||||||
from vllm.attention.layer import Attention # type: ignore
|
|
||||||
from vllm.compilation.vllm_inductor_pass import VllmInductorPass # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.compilation.passes.vllm_inductor_pass import VllmInductorPass
|
|
||||||
from vllm.model_executor.layers.attention import Attention
|
|
||||||
|
|
||||||
|
|
||||||
class QKNormRopeFusionPattern(BasePattern):
|
class QKNormRopeFusionPattern(BasePattern):
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ from vllm_ascend.distributed.kv_transfer.kv_pool.cpu_offload.metadata import (
|
|||||||
MetadataServerProc,
|
MetadataServerProc,
|
||||||
MLAConfig,
|
MLAConfig,
|
||||||
)
|
)
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from vllm.forward_context import ForwardContext
|
from vllm.forward_context import ForwardContext
|
||||||
@@ -35,10 +34,7 @@ if TYPE_CHECKING:
|
|||||||
from vllm.v1.kv_cache_interface import KVCacheConfig
|
from vllm.v1.kv_cache_interface import KVCacheConfig
|
||||||
from vllm.v1.request import Request
|
from vllm.v1.request import Request
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
from vllm.model_executor.layers.attention import Attention, MLAAttention
|
||||||
from vllm.attention.layer import Attention, MLAAttention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import Attention, MLAAttention
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ from vllm.v1.attention.backend import AttentionBackend # type: ignore
|
|||||||
from vllm.v1.kv_offload.mediums import CPULoadStoreSpec, GPULoadStoreSpec
|
from vllm.v1.kv_offload.mediums import CPULoadStoreSpec, GPULoadStoreSpec
|
||||||
from vllm.v1.kv_offload.worker.worker import OffloadingHandler, TransferResult, TransferSpec
|
from vllm.v1.kv_offload.worker.worker import OffloadingHandler, TransferResult, TransferSpec
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
logger = init_logger(__name__)
|
logger = init_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -155,14 +153,6 @@ class CpuNpuOffloadingHandler(OffloadingHandler):
|
|||||||
|
|
||||||
def get_finished(self) -> list[TransferResult]:
|
def get_finished(self) -> list[TransferResult]:
|
||||||
results: list[TransferResult] = []
|
results: list[TransferResult] = []
|
||||||
if vllm_version_is("v0.15.0"):
|
|
||||||
for job_id, event in self.transfer_events.items():
|
|
||||||
if event.query():
|
|
||||||
results.append((job_id, True))
|
|
||||||
self.events_pool.append(event)
|
|
||||||
for job_id, _ in results:
|
|
||||||
del self.transfer_events[job_id]
|
|
||||||
else:
|
|
||||||
finished_job_ids = []
|
finished_job_ids = []
|
||||||
for job_id, event in self.transfer_events.items():
|
for job_id, event in self.transfer_events.items():
|
||||||
if event.query():
|
if event.query():
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ from vllm.model_executor.layers.fused_moe.shared_fused_moe import SharedFusedMoE
|
|||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
from vllm_ascend.utils import vllm_version_is
|
||||||
|
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
from vllm.model_executor.layers.fused_moe.fused_moe_method_base import FusedMoEMethodBase # type: ignore
|
from vllm.model_executor.layers.fused_moe.fused_moe_method_base import FusedMoEMethodBase # type: ignore
|
||||||
from vllm.model_executor.layers.fused_moe.router.fused_moe_router import FusedMoERouter # type: ignore
|
from vllm.model_executor.layers.fused_moe.router.fused_moe_router import FusedMoERouter # type: ignore
|
||||||
from vllm.model_executor.layers.fused_moe.runner.default_moe_runner import DefaultMoERunner # type: ignore
|
from vllm.model_executor.layers.fused_moe.runner.default_moe_runner import DefaultMoERunner # type: ignore
|
||||||
@@ -169,7 +169,7 @@ class AscendUnquantizedFusedMoEMethod(UnquantizedFusedMoEMethod):
|
|||||||
return final_hidden_states
|
return final_hidden_states
|
||||||
|
|
||||||
|
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
# Please remove this inheritance after extending vllm, todo(wxs)
|
# Please remove this inheritance after extending vllm, todo(wxs)
|
||||||
class AscendMoERunner(DefaultMoERunner):
|
class AscendMoERunner(DefaultMoERunner):
|
||||||
"""
|
"""
|
||||||
@@ -323,10 +323,10 @@ class AscendFusedMoE(FusedMoE):
|
|||||||
|
|
||||||
setup_moe_comm_method(self.moe_config)
|
setup_moe_comm_method(self.moe_config)
|
||||||
self.quant_type = self._get_quant_type()
|
self.quant_type = self._get_quant_type()
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
self.runner = self._init_runner()
|
self.runner = self._init_runner()
|
||||||
|
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
|
|
||||||
def _init_runner(self):
|
def _init_runner(self):
|
||||||
# Storing the runner in the FusedMoE is an intermediate state, eventually
|
# Storing the runner in the FusedMoE is an intermediate state, eventually
|
||||||
@@ -372,7 +372,7 @@ class AscendFusedMoE(FusedMoE):
|
|||||||
"""
|
"""
|
||||||
return torch.ops.vllm.maybe_all_reduce_tensor_model_parallel(final_hidden_states)
|
return torch.ops.vllm.maybe_all_reduce_tensor_model_parallel(final_hidden_states)
|
||||||
|
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
self,
|
self,
|
||||||
@@ -519,7 +519,6 @@ class AscendSharedFusedMoE(SharedFusedMoE, AscendFusedMoE):
|
|||||||
):
|
):
|
||||||
AscendFusedMoE.__init__(self, **kwargs)
|
AscendFusedMoE.__init__(self, **kwargs)
|
||||||
|
|
||||||
if not vllm_version_is("0.15.0"):
|
|
||||||
self._routed_input_transform = routed_input_transform
|
self._routed_input_transform = routed_input_transform
|
||||||
self._shared_experts = shared_experts
|
self._shared_experts = shared_experts
|
||||||
self.use_overlapped = use_overlapped
|
self.use_overlapped = use_overlapped
|
||||||
@@ -533,7 +532,7 @@ class AscendSharedFusedMoE(SharedFusedMoE, AscendFusedMoE):
|
|||||||
logger.info_once("Sequence parallelism is enabled, shared experts are replicated for best performance.")
|
logger.info_once("Sequence parallelism is enabled, shared experts are replicated for best performance.")
|
||||||
|
|
||||||
self._gate = gate
|
self._gate = gate
|
||||||
if not vllm_version_is("0.15.0"):
|
if not vllm_version_is("0.16.0"):
|
||||||
# Recreate the runner with the correct shared_experts parameter
|
# Recreate the runner with the correct shared_experts parameter
|
||||||
# The parent class created the runner before self._shared_experts was set
|
# The parent class created the runner before self._shared_experts was set
|
||||||
self.runner = self._init_runner()
|
self.runner = self._init_runner()
|
||||||
|
|||||||
@@ -25,18 +25,13 @@ from torch import nn
|
|||||||
from vllm.config import CacheConfig, get_current_vllm_config
|
from vllm.config import CacheConfig, get_current_vllm_config
|
||||||
from vllm.distributed import get_tensor_model_parallel_world_size
|
from vllm.distributed import get_tensor_model_parallel_world_size
|
||||||
from vllm.forward_context import ForwardContext, get_forward_context
|
from vllm.forward_context import ForwardContext, get_forward_context
|
||||||
|
from vllm.model_executor.layers.attention import MLAAttention
|
||||||
from vllm.model_executor.layers.mla import MLAModules, MultiHeadLatentAttentionWrapper
|
from vllm.model_executor.layers.mla import MLAModules, MultiHeadLatentAttentionWrapper
|
||||||
from vllm.model_executor.layers.quantization import QuantizationConfig
|
from vllm.model_executor.layers.quantization import QuantizationConfig
|
||||||
from vllm.utils.torch_utils import direct_register_custom_op
|
from vllm.utils.torch_utils import direct_register_custom_op
|
||||||
from vllm.v1.attention.backend import AttentionMetadata # type: ignore
|
from vllm.v1.attention.backend import AttentionMetadata # type: ignore
|
||||||
|
|
||||||
from vllm_ascend.ascend_config import get_ascend_config
|
from vllm_ascend.ascend_config import get_ascend_config
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
|
||||||
from vllm.attention.layer import MLAAttention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import MLAAttention
|
|
||||||
|
|
||||||
|
|
||||||
class IndexerWrapper(nn.Module):
|
class IndexerWrapper(nn.Module):
|
||||||
@@ -126,7 +121,6 @@ class AscendMultiHeadLatentAttention(MultiHeadLatentAttentionWrapper):
|
|||||||
o_proj=mla_modules.o_proj,
|
o_proj=mla_modules.o_proj,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
original_process_weights = self.mla_attn.process_weights_after_loading
|
original_process_weights = self.mla_attn.process_weights_after_loading
|
||||||
|
|
||||||
def wrapped_process_weights(act_dtype: torch.dtype):
|
def wrapped_process_weights(act_dtype: torch.dtype):
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ import os
|
|||||||
import vllm_ascend.patch.platform.patch_distributed # noqa
|
import vllm_ascend.patch.platform.patch_distributed # noqa
|
||||||
import vllm_ascend.patch.platform.patch_mamba_config # noqa
|
import vllm_ascend.patch.platform.patch_mamba_config # noqa
|
||||||
import vllm_ascend.patch.platform.patch_sched_yield # noqa
|
import vllm_ascend.patch.platform.patch_sched_yield # noqa
|
||||||
from vllm_ascend import envs
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if os.getenv("DYNAMIC_EPLB", "false").lower() in ("true", "1") or os.getenv("EXPERT_MAP_RECORD", "false") == "true":
|
if os.getenv("DYNAMIC_EPLB", "false").lower() in ("true", "1") or os.getenv("EXPERT_MAP_RECORD", "false") == "true":
|
||||||
import vllm_ascend.patch.platform.patch_multiproc_executor # noqa
|
import vllm_ascend.patch.platform.patch_multiproc_executor # noqa
|
||||||
|
|
||||||
if envs.VLLM_ASCEND_BALANCE_SCHEDULING and vllm_version_is("0.15.0"):
|
|
||||||
import vllm_ascend.patch.platform.patch_balance_schedule # noqa
|
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
import torch
|
import torch
|
||||||
import vllm.v1.worker.utils as utils
|
import vllm.v1.worker.utils as utils
|
||||||
|
from vllm.model_executor.layers.attention import Attention
|
||||||
from vllm.v1.worker.utils import defaultdict, extract_layer_index
|
from vllm.v1.worker.utils import defaultdict, extract_layer_index
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
|
||||||
from vllm.attention.layer import Attention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import Attention
|
|
||||||
|
|
||||||
|
|
||||||
# Without this patch, it will raise an exception when initialize kv_cache.
|
# Without this patch, it will raise an exception when initialize kv_cache.
|
||||||
# TODO To remove the patch, we need check why the original bind_kv_cache raises an NotImplementedError.
|
# TODO To remove the patch, we need check why the original bind_kv_cache raises an NotImplementedError.
|
||||||
|
|||||||
@@ -21,7 +21,14 @@ import vllm
|
|||||||
from vllm.v1.worker.gpu.attn_utils import build_slot_mappings_by_layer
|
from vllm.v1.worker.gpu.attn_utils import build_slot_mappings_by_layer
|
||||||
from vllm.v1.worker.gpu.input_batch import InputBatch
|
from vllm.v1.worker.gpu.input_batch import InputBatch
|
||||||
from vllm.v1.worker.gpu.sample.gumbel import gumbel_sample
|
from vllm.v1.worker.gpu.sample.gumbel import gumbel_sample
|
||||||
from vllm.v1.worker.gpu.spec_decode.eagle import prepare_eagle_decode, prepare_eagle_inputs
|
|
||||||
|
from vllm_ascend.utils import vllm_version_is
|
||||||
|
|
||||||
|
if vllm_version_is("v0.16.0"):
|
||||||
|
from vllm.v1.worker.gpu.spec_decode.eagle import prepare_eagle_decode, prepare_eagle_inputs
|
||||||
|
else:
|
||||||
|
from vllm.v1.worker.gpu.spec_decode.eagle.speculator import prepare_eagle_decode, prepare_eagle_inputs
|
||||||
|
|
||||||
|
|
||||||
from vllm_ascend.worker.v2.attn_utils import build_attn_metadata
|
from vllm_ascend.worker.v2.attn_utils import build_attn_metadata
|
||||||
|
|
||||||
@@ -168,4 +175,7 @@ def propose(
|
|||||||
return self.draft_tokens[:num_reqs]
|
return self.draft_tokens[:num_reqs]
|
||||||
|
|
||||||
|
|
||||||
vllm.v1.worker.gpu.spec_decode.eagle.EagleSpeculator.propose = propose
|
if vllm_version_is("v0.16.0"):
|
||||||
|
vllm.v1.worker.gpu.spec_decode.eagle.EagleSpeculator.propose = propose
|
||||||
|
else:
|
||||||
|
vllm.v1.worker.gpu.spec_decode.eagle.speculator.EagleSpeculator.propose = propose
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ class NPUPlatform(Platform):
|
|||||||
_CUSTOM_OP_REGISTERED = True
|
_CUSTOM_OP_REGISTERED = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_attn_backend_cls(cls, selected_backend, attn_selector_config):
|
def get_attn_backend_cls(cls, selected_backend, attn_selector_config, num_heads: int | None = None):
|
||||||
key = (attn_selector_config.use_mla, attn_selector_config.use_sparse)
|
key = (attn_selector_config.use_mla, attn_selector_config.use_sparse)
|
||||||
|
|
||||||
backend_map = {
|
backend_map = {
|
||||||
|
|||||||
@@ -117,6 +117,18 @@ class AscendLinearMethod(LinearMethodBase):
|
|||||||
if hasattr(self.quant_method, "process_weights_after_loading"):
|
if hasattr(self.quant_method, "process_weights_after_loading"):
|
||||||
self.quant_method.process_weights_after_loading(layer)
|
self.quant_method.process_weights_after_loading(layer)
|
||||||
|
|
||||||
|
def get_computed_params(self) -> set[str]:
|
||||||
|
"""Return parameter name patterns that are computed, not loaded.
|
||||||
|
|
||||||
|
These parameters are computed during process_weights_after_loading
|
||||||
|
rather than loaded from checkpoint:
|
||||||
|
- weight_offset: Zero for symmetric quantization
|
||||||
|
- quant_bias: Computed from weight statistics
|
||||||
|
- deq_scale: Computed as input_scale * weight_scale
|
||||||
|
- weight_scale: May be computed or have default values for some models
|
||||||
|
"""
|
||||||
|
return {"weight_offset", "quant_bias", "deq_scale", "weight_scale"}
|
||||||
|
|
||||||
def apply(
|
def apply(
|
||||||
self,
|
self,
|
||||||
layer: torch.nn.Module,
|
layer: torch.nn.Module,
|
||||||
|
|||||||
@@ -401,11 +401,6 @@ class AscendModelSlimConfig(QuantizationConfig):
|
|||||||
self.packed_modules_mapping = packed_modules_model_mapping[model_type]
|
self.packed_modules_mapping = packed_modules_model_mapping[model_type]
|
||||||
prefix = self.quant_prefix_mapper(model_type, prefix)
|
prefix = self.quant_prefix_mapper(model_type, prefix)
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
|
||||||
from vllm.attention.layer import Attention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import Attention
|
from vllm.model_executor.layers.attention import Attention
|
||||||
|
|
||||||
if model_type != "kimi_k2":
|
if model_type != "kimi_k2":
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ from vllm_ascend.attention.utils import AscendCommonAttentionMetadata
|
|||||||
from vllm_ascend.compilation.acl_graph import ACLGraphWrapper, update_full_graph_params
|
from vllm_ascend.compilation.acl_graph import ACLGraphWrapper, update_full_graph_params
|
||||||
from vllm_ascend.ops.triton.spec_decode.utils import prepare_inputs_padded_kernel
|
from vllm_ascend.ops.triton.spec_decode.utils import prepare_inputs_padded_kernel
|
||||||
from vllm_ascend.ops.triton.triton_utils import get_vectorcore_num
|
from vllm_ascend.ops.triton.triton_utils import get_vectorcore_num
|
||||||
from vllm_ascend.utils import enable_sp, lmhead_tp_enable, shared_expert_dp_enabled, vllm_version_is
|
from vllm_ascend.utils import enable_sp, lmhead_tp_enable, shared_expert_dp_enabled
|
||||||
|
|
||||||
# Currently we will fix block size to a small one since `num_reqs` can't be too large
|
# Currently we will fix block size to a small one since `num_reqs` can't be too large
|
||||||
_PREPARE_INPUTS_BLOCK_SIZE = 4
|
_PREPARE_INPUTS_BLOCK_SIZE = 4
|
||||||
@@ -357,7 +357,6 @@ class EagleProposer(VllmEagleProposer):
|
|||||||
is_draft_model=True,
|
is_draft_model=True,
|
||||||
draft_attn_metadatas=multi_steps_attn_metadata,
|
draft_attn_metadatas=multi_steps_attn_metadata,
|
||||||
):
|
):
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
# Reset MOE layer index before first model call
|
# Reset MOE layer index before first model call
|
||||||
forward_context = get_forward_context()
|
forward_context = get_forward_context()
|
||||||
if forward_context is not None:
|
if forward_context is not None:
|
||||||
@@ -522,7 +521,6 @@ class EagleProposer(VllmEagleProposer):
|
|||||||
is_draft_model=True,
|
is_draft_model=True,
|
||||||
draft_attn_metadatas=multi_steps_attn_metadata,
|
draft_attn_metadatas=multi_steps_attn_metadata,
|
||||||
):
|
):
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
# Reset MOE layer index for forward pass
|
# Reset MOE layer index for forward pass
|
||||||
forward_context = get_forward_context()
|
forward_context = get_forward_context()
|
||||||
if forward_context is not None:
|
if forward_context is not None:
|
||||||
@@ -617,7 +615,6 @@ class EagleProposer(VllmEagleProposer):
|
|||||||
forward_context.num_accept_tokens = batch_size
|
forward_context.num_accept_tokens = batch_size
|
||||||
|
|
||||||
for draft_step in range(self.num_speculative_tokens - 1):
|
for draft_step in range(self.num_speculative_tokens - 1):
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
# Reset MOE layer index for each draft step iteration
|
# Reset MOE layer index for each draft step iteration
|
||||||
forward_context = get_forward_context()
|
forward_context = get_forward_context()
|
||||||
if forward_context is not None:
|
if forward_context is not None:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from vllm_ascend.attention.utils import AscendCommonAttentionMetadata
|
|||||||
from vllm_ascend.compilation.acl_graph import ACLGraphWrapper
|
from vllm_ascend.compilation.acl_graph import ACLGraphWrapper
|
||||||
from vllm_ascend.ops.rotary_embedding import get_cos_and_sin_mla, update_cos_sin
|
from vllm_ascend.ops.rotary_embedding import get_cos_and_sin_mla, update_cos_sin
|
||||||
from vllm_ascend.spec_decode.eagle_proposer import EagleProposer
|
from vllm_ascend.spec_decode.eagle_proposer import EagleProposer
|
||||||
from vllm_ascend.utils import lmhead_tp_enable, vllm_version_is
|
from vllm_ascend.utils import lmhead_tp_enable
|
||||||
|
|
||||||
|
|
||||||
class MtpProposer(EagleProposer):
|
class MtpProposer(EagleProposer):
|
||||||
@@ -130,7 +130,6 @@ class MtpProposer(EagleProposer):
|
|||||||
is_draft_model=True,
|
is_draft_model=True,
|
||||||
in_profile_run=is_profile,
|
in_profile_run=is_profile,
|
||||||
):
|
):
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
# Reset MOE layer index for each MTP step iteration
|
# Reset MOE layer index for each MTP step iteration
|
||||||
forward_context = get_forward_context()
|
forward_context = get_forward_context()
|
||||||
if forward_context is not None:
|
if forward_context is not None:
|
||||||
@@ -341,7 +340,6 @@ class MtpProposer(EagleProposer):
|
|||||||
num_actual_tokens=num_tokens,
|
num_actual_tokens=num_tokens,
|
||||||
is_draft_model=True,
|
is_draft_model=True,
|
||||||
):
|
):
|
||||||
if not vllm_version_is("v0.15.0"):
|
|
||||||
# Reset MOE layer index for each MTP step to match all_moe_layers registration
|
# Reset MOE layer index for each MTP step to match all_moe_layers registration
|
||||||
forward_context = get_forward_context()
|
forward_context = get_forward_context()
|
||||||
if forward_context is not None:
|
if forward_context is not None:
|
||||||
|
|||||||
@@ -525,11 +525,6 @@ def update_aclgraph_sizes(vllm_config: VllmConfig) -> None:
|
|||||||
"increase the number of supported shapes, set HCCL_OP_EXPANSION_MODE=AIV."
|
"increase the number of supported shapes, set HCCL_OP_EXPANSION_MODE=AIV."
|
||||||
)
|
)
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("0.15.0"):
|
|
||||||
arch_name = vllm_config.model_config.architectures[0]
|
|
||||||
else:
|
|
||||||
arch_name = vllm_config.model_config.architecture
|
arch_name = vllm_config.model_config.architecture
|
||||||
|
|
||||||
# If original sizes exceed maximum, sample a representative subset
|
# If original sizes exceed maximum, sample a representative subset
|
||||||
|
|||||||
@@ -138,12 +138,8 @@ if TYPE_CHECKING:
|
|||||||
else:
|
else:
|
||||||
xgr = LazyLoader("xgr", globals(), "xgrammar")
|
xgr = LazyLoader("xgr", globals(), "xgrammar")
|
||||||
|
|
||||||
from vllm_ascend.utils import vllm_version_is
|
|
||||||
|
|
||||||
if vllm_version_is("v0.15.0"):
|
from vllm.model_executor.layers.attention import Attention, MLAAttention
|
||||||
from vllm.attention.layer import Attention, MLAAttention # type: ignore
|
|
||||||
else:
|
|
||||||
from vllm.model_executor.layers.attention import Attention, MLAAttention
|
|
||||||
|
|
||||||
# if true, allow tensor initialization and casting with internal format (e.g., NZ)
|
# if true, allow tensor initialization and casting with internal format (e.g., NZ)
|
||||||
torch.npu.config.allow_internal_format = True
|
torch.npu.config.allow_internal_format = True
|
||||||
|
|||||||
@@ -531,6 +531,9 @@ class NPUWorker(WorkerBase):
|
|||||||
def pin_lora(self, lora_id: int) -> bool:
|
def pin_lora(self, lora_id: int) -> bool:
|
||||||
return self.model_runner.pin_lora(lora_id)
|
return self.model_runner.pin_lora(lora_id)
|
||||||
|
|
||||||
|
def reset_encoder_cache(self) -> None:
|
||||||
|
self.model_runner.reset_encoder_cache()
|
||||||
|
|
||||||
def execute_dummy_batch(self) -> None:
|
def execute_dummy_batch(self) -> None:
|
||||||
self.model_runner._dummy_run(num_tokens=self.model_runner.decode_token_per_req, uniform_decode=True)
|
self.model_runner._dummy_run(num_tokens=self.model_runner.decode_token_per_req, uniform_decode=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user