diff --git a/.github/workflows/Ascend950-ci.yml b/.github/workflows/Ascend950-ci.yml index 5f1bc2ad8a..f8865ab659 100644 --- a/.github/workflows/Ascend950-ci.yml +++ b/.github/workflows/Ascend950-ci.yml @@ -100,18 +100,23 @@ jobs: ccache --zero-stats NUM_PROCS=$(( $(nproc) / 3 )) if [ "$NUM_PROCS" -lt 1 ]; then NUM_PROCS=1; fi - # setup.py is at repo root on main, under python/ on older release branches. - if [ -f setup.py ]; then - SETUP_DIR="." + # setup.py or setup_ascend.py is at repo root on main, under python/ on older release branches. + if [ -f setup_ascend.py ]; then + SETUP_DIR="./" + SETUP_PY="setup_ascend.py" + elif [ -f setup.py ]; then + SETUP_DIR="./" + SETUP_PY="setup.py" elif [ -f python/setup.py ]; then SETUP_DIR="python" + SETUP_PY="setup.py" else - echo "ERROR: setup.py not found" >&2 + echo "ERROR: setup.py or setup_ascend.py not found" >&2 exit 1 fi cd "$SETUP_DIR" MAX_JOBS="$NUM_PROCS" \ - python setup.py bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/wheelhouse" + python ${SETUP_PY} bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/wheelhouse" - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/DynamicCVPipeline-ci.yml b/.github/workflows/DynamicCVPipeline-ci.yml index 5a451d1485..782e0ea4ce 100644 --- a/.github/workflows/DynamicCVPipeline-ci.yml +++ b/.github/workflows/DynamicCVPipeline-ci.yml @@ -78,7 +78,21 @@ jobs: NUM_PROCS=$(( $(nproc) / 3 )) if [ "$NUM_PROCS" -lt 1 ]; then NUM_PROCS=1; fi cd base - MAX_JOBS="$NUM_PROCS" python setup.py bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/base/wheelhouse" + if [ -f setup_ascend.py ]; then + SETUP_DIR="./" + SETUP_PY="setup_ascend.py" + elif [ -f setup.py ]; then + SETUP_DIR="./" + SETUP_PY="setup.py" + elif [ -f python/setup.py ]; then + SETUP_DIR="python" + SETUP_PY="setup.py" + else + echo "ERROR: setup.py or setup_ascend.py not found" >&2 + exit 1 + fi + cd "$SETUP_DIR" + MAX_JOBS="$NUM_PROCS" python ${SETUP_PY} bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/base/wheelhouse" - name: Build triton-ascend pr shell: bash @@ -98,7 +112,21 @@ jobs: NUM_PROCS=$(( $(nproc) / 3 )) if [ "$NUM_PROCS" -lt 1 ]; then NUM_PROCS=1; fi cd pr - MAX_JOBS="$NUM_PROCS" python setup.py bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/pr/wheelhouse" + if [ -f setup_ascend.py ]; then + SETUP_DIR="./" + SETUP_PY="setup_ascend.py" + elif [ -f setup.py ]; then + SETUP_DIR="./" + SETUP_PY="setup.py" + elif [ -f python/setup.py ]; then + SETUP_DIR="python" + SETUP_PY="setup.py" + else + echo "ERROR: setup.py or setup_ascend.py not found" >&2 + exit 1 + fi + cd "$SETUP_DIR" + MAX_JOBS="$NUM_PROCS" python ${SETUP_PY} bdist_wheel --dist-dir="${GITHUB_WORKSPACE}/pr/wheelhouse" - name: generate ttadapter shell: bash diff --git a/.github/workflows/integration-tests-ascend.yml b/.github/workflows/integration-tests-ascend.yml index 8447e488de..95bd432a15 100644 --- a/.github/workflows/integration-tests-ascend.yml +++ b/.github/workflows/integration-tests-ascend.yml @@ -102,8 +102,22 @@ jobs: ccache --zero-stats NUM_PROCS=$(( $(nproc) / 3 )) if [ "$NUM_PROCS" -lt 1 ]; then NUM_PROCS=1; fi + if [ -f setup_ascend.py ]; then + SETUP_DIR="./" + SETUP_PY="setup_ascend.py" + elif [ -f setup.py ]; then + SETUP_DIR="./" + SETUP_PY="setup.py" + elif [ -f python/setup.py ]; then + SETUP_DIR="python" + SETUP_PY="setup.py" + else + echo "ERROR: setup.py or setup_ascend.py not found" >&2 + exit 1 + fi + cd "$SETUP_DIR" MAX_JOBS="$NUM_PROCS" \ - ${PYTHON} setup.py bdist_wheel + ${PYTHON} ${SETUP_PY} bdist_wheel ${PYTHON} -m pip install dist/*.whl - name: CCache stats diff --git a/third_party/ascend/unittest/pytest_ut/test_specialization_cache_npu.py b/third_party/ascend/unittest/pytest_ut/test_specialization_cache_npu.py index b2cc1bfde5..b238b7d4e8 100644 --- a/third_party/ascend/unittest/pytest_ut/test_specialization_cache_npu.py +++ b/third_party/ascend/unittest/pytest_ut/test_specialization_cache_npu.py @@ -40,14 +40,14 @@ def _clear_kernel_cache(kernel=_add_value): def _run_case(n, src, dst, mode): - _add_value[(1,)](src, dst, n, 3, BLOCK=32, compile_mode=mode) + _add_value[(1, )](src, dst, n, 3, BLOCK=32, compile_mode=mode) torch.npu.synchronize() expected = src[:n] + 3 torch.testing.assert_close(dst[:n], expected) def _run_annotated_case(n, value, src, dst, mode): - _add_annotated_value[(1,)](src, dst, n, value, BLOCK=32, compile_mode=mode) + _add_annotated_value[(1, )](src, dst, n, value, BLOCK=32, compile_mode=mode) torch.npu.synchronize() expected = src[:n] + value torch.testing.assert_close(dst[:n], expected) diff --git a/third_party/ascend/unittest/pytest_ut/test_specialization_cache_unit.py b/third_party/ascend/unittest/pytest_ut/test_specialization_cache_unit.py index 21f3dc965d..1350ef6e49 100644 --- a/third_party/ascend/unittest/pytest_ut/test_specialization_cache_unit.py +++ b/third_party/ascend/unittest/pytest_ut/test_specialization_cache_unit.py @@ -8,17 +8,14 @@ import pytest import torch - from triton.backends.ascend.compiler import AscendBackend from triton.backends.compiler import GPUTarget from triton.runtime.jit import KernelParam, compute_cache_key, create_function_from_signature - pytestmark = pytest.mark.backend("native") class PointerArg: - dtype = torch.float32 def __init__(self, address): @@ -160,8 +157,8 @@ def kernel(value): assert one_specialization == [("constexpr", 1)] assert two_specialization == [(annotation, "")] - assert compute_cache_key(cache, one_specialization, one_options) != compute_cache_key( - cache, two_specialization, two_options) + assert compute_cache_key(cache, one_specialization, + one_options) != compute_cache_key(cache, two_specialization, two_options) @pytest.mark.parametrize("options", [SIMD_OPTIONS[0], *SIMT_OPTIONS])