From 154e5c776d295e8ac35bc1f848c9e383aa8717a1 Mon Sep 17 00:00:00 2001 From: Tflowers-0129 <2906339855@qq.com> Date: Sat, 14 Mar 2026 09:48:48 +0800 Subject: [PATCH 1/4] [310P] remove triton-ascend's install of 310p devices Signed-off-by: Tflowers-0129 <2906339855@qq.com> --- pyproject.toml | 6 +++--- setup.py | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 061db04660dd..faeaba229b16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] -# Should be mirrored in requirements.txt +# Should be mirrored in requirements.txt, except triton-ascend. +# triton-ascend is handled in setup.py and skipped for 310P SOC versions. requires = [ "attrs", "cmake>=3.26", @@ -29,8 +30,7 @@ requires = [ "fastapi<0.124.0", "opencv-python-headless<=4.11.0.86", # Required to avoid numpy version conflict with vllm "compressed_tensors>=0.11.0", - "arctic-inference==0.1.1", - "triton-ascend==3.2.0" + "arctic-inference==0.1.1" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index d7a8f68cc34c..315b72173331 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,7 @@ import importlib.util import logging import os +import re import subprocess import sys from sysconfig import get_paths @@ -449,15 +450,30 @@ def read_readme() -> str: def get_requirements() -> list[str]: """Get Python package dependencies from requirements.txt.""" + def _requirement_name(requirement: str) -> str: + requirement = requirement.split(";", maxsplit=1)[0].strip() + return re.split(r"[<>=!~ \\[]", requirement, maxsplit=1)[0].lower() + + soc_version = (envs.SOC_VERSION or "").lower() + # Align with CMakeLists.txt: if(SOC_VERSION MATCHES "ascend310p.*") + skip_triton_ascend = bool(re.match(r"^ascend310p.*", soc_version)) + if skip_triton_ascend: + logger.info("Skip `triton-ascend` for 310P SOC version `%s`.", envs.SOC_VERSION) + def _read_requirements(filename: str) -> list[str]: with open(get_path(filename)) as f: - requirements = f.read().strip().split("\n") + requirements = f.read().splitlines() resolved_requirements = [] for line in requirements: + line = line.strip() + if not line or line.startswith("#"): + continue if line.startswith("-r "): resolved_requirements += _read_requirements(line.split()[1]) elif line.startswith("--"): continue + elif skip_triton_ascend and _requirement_name(line) == "triton-ascend": + logger.info("Filtered requirement `%s` for 310P SOC version `%s`.", line, envs.SOC_VERSION) else: resolved_requirements.append(line) return resolved_requirements From 125968cce08e806b45c2e3ab59e2d39f1f728746 Mon Sep 17 00:00:00 2001 From: Tflowers-0129 <2906339855@qq.com> Date: Sat, 14 Mar 2026 10:23:01 +0800 Subject: [PATCH 2/4] cleancode Signed-off-by: Tflowers-0129 <2906339855@qq.com> --- setup.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 315b72173331..07ccfca1724e 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ import sys from sysconfig import get_paths +from packaging.requirements import Requirement from setuptools import Command, Extension, find_packages, setup from setuptools.command.build_ext import build_ext from setuptools.command.build_py import build_py @@ -450,16 +451,9 @@ def read_readme() -> str: def get_requirements() -> list[str]: """Get Python package dependencies from requirements.txt.""" - def _requirement_name(requirement: str) -> str: - requirement = requirement.split(";", maxsplit=1)[0].strip() - return re.split(r"[<>=!~ \\[]", requirement, maxsplit=1)[0].lower() - soc_version = (envs.SOC_VERSION or "").lower() # Align with CMakeLists.txt: if(SOC_VERSION MATCHES "ascend310p.*") - skip_triton_ascend = bool(re.match(r"^ascend310p.*", soc_version)) - if skip_triton_ascend: - logger.info("Skip `triton-ascend` for 310P SOC version `%s`.", envs.SOC_VERSION) - + skip_triton_ascend = soc_version.startswith("ascend310p") def _read_requirements(filename: str) -> list[str]: with open(get_path(filename)) as f: requirements = f.read().splitlines() @@ -472,8 +466,8 @@ def _read_requirements(filename: str) -> list[str]: resolved_requirements += _read_requirements(line.split()[1]) elif line.startswith("--"): continue - elif skip_triton_ascend and _requirement_name(line) == "triton-ascend": - logger.info("Filtered requirement `%s` for 310P SOC version `%s`.", line, envs.SOC_VERSION) + elif skip_triton_ascend and line.startswith("triton-ascend"): + continue else: resolved_requirements.append(line) return resolved_requirements From a21cb82f61aa8f44b265a60a58b8e287f6f24339 Mon Sep 17 00:00:00 2001 From: Tflowers-0129 <2906339855@qq.com> Date: Sat, 14 Mar 2026 10:24:00 +0800 Subject: [PATCH 3/4] cleancode Signed-off-by: Tflowers-0129 <2906339855@qq.com> --- setup.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 07ccfca1724e..e55e4bf8c33c 100644 --- a/setup.py +++ b/setup.py @@ -20,12 +20,10 @@ import importlib.util import logging import os -import re import subprocess import sys from sysconfig import get_paths -from packaging.requirements import Requirement from setuptools import Command, Extension, find_packages, setup from setuptools.command.build_ext import build_ext from setuptools.command.build_py import build_py @@ -454,6 +452,7 @@ def get_requirements() -> list[str]: soc_version = (envs.SOC_VERSION or "").lower() # Align with CMakeLists.txt: if(SOC_VERSION MATCHES "ascend310p.*") skip_triton_ascend = soc_version.startswith("ascend310p") + def _read_requirements(filename: str) -> list[str]: with open(get_path(filename)) as f: requirements = f.read().splitlines() @@ -464,9 +463,7 @@ def _read_requirements(filename: str) -> list[str]: continue if line.startswith("-r "): resolved_requirements += _read_requirements(line.split()[1]) - elif line.startswith("--"): - continue - elif skip_triton_ascend and line.startswith("triton-ascend"): + elif line.startswith("--") or skip_triton_ascend and line.startswith("triton-ascend"): continue else: resolved_requirements.append(line) From f85adeec5d5f759e0b3bbc8fbee5bf9b47c63f1d Mon Sep 17 00:00:00 2001 From: Tflowers-0129 <2906339855@qq.com> Date: Fri, 10 Apr 2026 09:22:38 +0800 Subject: [PATCH 4/4] uninstall triton in the dockerfile Signed-off-by: Tflowers-0129 <2906339855@qq.com> --- Dockerfile.310p | 3 +-- Dockerfile.310p.openEuler | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile.310p b/Dockerfile.310p index f0a44c6241c5..04b35dafa6b8 100644 --- a/Dockerfile.310p +++ b/Dockerfile.310p @@ -55,8 +55,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi source /usr/local/Ascend/nnal/atb/set_env.sh && \ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ python3 -m pip install -v -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ - python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install -v triton-ascend==3.2.0 && \ + python3 -m pip uninstall -y triton triton-ascend || true && \ python3 -m pip cache purge # Append `libascend_hal.so` path (devlib) to LD_LIBRARY_PATH diff --git a/Dockerfile.310p.openEuler b/Dockerfile.310p.openEuler index 207186e6bf12..dff5ba7eed5f 100644 --- a/Dockerfile.310p.openEuler +++ b/Dockerfile.310p.openEuler @@ -54,8 +54,7 @@ RUN export PIP_EXTRA_INDEX_URL=https://mirrors.huaweicloud.com/ascend/repos/pypi export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/`uname -i`-linux/devlib && \ export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/12:/usr/include/c++/12/`uname -i`-openEuler-linux && \ python3 -m pip install -v -e /vllm-workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \ - python3 -m pip uninstall -y triton triton-ascend && \ - python3 -m pip install -v triton-ascend==3.2.0 && \ + python3 -m pip uninstall -y triton triton-ascend || true && \ python3 -m pip cache purge RUN echo "export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD" >> ~/.bashrc