已合并
fix: 修复告警代码 #4781
why you创建于 9 天前
fix: 修复告警代码 #4781
已合并
共 11 个文件变更+26-16
| @@ -1,4 +1,5 @@ | |||
| 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 2 | +# -*- coding: utf-8 -*- | ||
| 2 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 3 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 3 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| 4 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| @@ -12,9 +12,8 @@ | |||
| 12 | set -euo pipefail | 12 | set -euo pipefail |
| 13 | 13 | ||
| 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 15 | -PROJECT_DIR="${SCRIPT_DIR}" | 15 | +BUILD_DIR="${SCRIPT_DIR}/build" |
| 16 | -BUILD_DIR="${PROJECT_DIR}/build" | 16 | +OUTPUT_DIR="${SCRIPT_DIR}/output" |
| 17 | -OUTPUT_DIR="${PROJECT_DIR}/output" | ||
| 18 | 17 | ||
| 19 | info() { | 18 | info() { |
| 20 | echo "[INFO] $*" | 19 | echo "[INFO] $*" |
| @@ -45,10 +44,10 @@ mkdir -p "${BUILD_DIR}" "${OUTPUT_DIR}" | |||
| 45 | # Step 1: 编译 TileLang kernel,产出 .so | 44 | # Step 1: 编译 TileLang kernel,产出 .so |
| 46 | info "Step 1/4: compile TileLang kernel" | 45 | info "Step 1/4: compile TileLang kernel" |
| 47 | ( | 46 | ( |
| 48 | - cd "${PROJECT_DIR}/add_custom_kernel" | 47 | + cd "${SCRIPT_DIR}/add_custom_kernel" |
| 49 | python3 add_custom_kernel.py | 48 | python3 add_custom_kernel.py |
| 50 | ) | 49 | ) |
| 51 | -if [[ ! -f "${PROJECT_DIR}/add_custom_kernel/add_kernel.so" ]]; then | 50 | +if [[ ! -f "${SCRIPT_DIR}/add_custom_kernel/add_kernel.so" ]]; then |
| 52 | error "TileLang kernel .so not found: add_custom_kernel/add_kernel.so" | 51 | error "TileLang kernel .so not found: add_custom_kernel/add_kernel.so" |
| 53 | error "Please check TileLang installation and kernel compilation output." | 52 | error "Please check TileLang installation and kernel compilation output." |
| 54 | exit 1 | 53 | exit 1 |
| @@ -57,7 +56,7 @@ info "TileLang kernel .so generated." | |||
| 57 | 56 | ||
| 58 | # Step 2: 构建 libcust_opapi.so + session_run(含将 add_kernel.so 安装到 OPP 包) | 57 | # Step 2: 构建 libcust_opapi.so + session_run(含将 add_kernel.so 安装到 OPP 包) |
| 59 | info "Step 2/4: build custom op library and session_run" | 58 | info "Step 2/4: build custom op library and session_run" |
| 60 | -cmake -S "${PROJECT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release | 59 | +cmake -S "${SCRIPT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release |
| 61 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" | 60 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" |
| 62 | cmake --install "${BUILD_DIR}" | 61 | cmake --install "${BUILD_DIR}" |
| 63 | 62 | ||
| @@ -1,4 +1,5 @@ | |||
| 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 2 | +# -*- coding: utf-8 -*- | ||
| 2 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 3 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 3 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| 4 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| @@ -12,9 +12,8 @@ | |||
| 12 | set -euo pipefail | 12 | set -euo pipefail |
| 13 | 13 | ||
| 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 15 | -PROJECT_DIR="${SCRIPT_DIR}" | 15 | +BUILD_DIR="${SCRIPT_DIR}/build" |
| 16 | -BUILD_DIR="${PROJECT_DIR}/build" | 16 | +OUTPUT_DIR="${SCRIPT_DIR}/output" |
| 17 | -OUTPUT_DIR="${PROJECT_DIR}/output" | ||
| 18 | AIR_PATH="${BUILD_DIR}/tilelang_add_offline.air" | 17 | AIR_PATH="${BUILD_DIR}/tilelang_add_offline.air" |
| 19 | OM_PATH="${BUILD_DIR}/tilelang_add_offline" | 18 | OM_PATH="${BUILD_DIR}/tilelang_add_offline" |
| 20 | 19 | ||
| @@ -47,7 +46,7 @@ SOC_VERSION="${SOC_VERSION:-Ascend910_9362}" | |||
| 47 | mkdir -p "${BUILD_DIR}" "${OUTPUT_DIR}" | 46 | mkdir -p "${BUILD_DIR}" "${OUTPUT_DIR}" |
| 48 | 47 | ||
| 49 | info "Step 1/4: build custom op library, graph_build and model_exec" | 48 | info "Step 1/4: build custom op library, graph_build and model_exec" |
| 50 | -cmake -S "${PROJECT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release | 49 | +cmake -S "${SCRIPT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release |
| 51 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" | 50 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" |
| 52 | cmake --install "${BUILD_DIR}" | 51 | cmake --install "${BUILD_DIR}" |
| 53 | 52 | ||
| @@ -82,7 +81,7 @@ atc --framework=1 --model="${AIR_PATH}" --output="${OM_PATH}" --soc_version="${S | |||
| 82 | exit 1 | 81 | exit 1 |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | -OM_FILE="${OM_PATH}.om" | 84 | +OM_FILE="${BUILD_DIR}/tilelang_add_offline.om" |
| 86 | if [[ ! -f "${OM_FILE}" ]]; then | 85 | if [[ ! -f "${OM_FILE}" ]]; then |
| 87 | error "OM model not generated: ${OM_FILE}" | 86 | error "OM model not generated: ${OM_FILE}" |
| 88 | exit 1 | 87 | exit 1 |
| @@ -1,4 +1,5 @@ | |||
| 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 1 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 2 | +# -*- coding: utf-8 -*- | ||
| 2 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 3 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 3 | # CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | # CANN Open Software License Agreement Version 2.0 (the "License"). |
| 4 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| @@ -12,9 +12,8 @@ | |||
| 12 | set -euo pipefail | 12 | set -euo pipefail |
| 13 | 13 | ||
| 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 15 | -PROJECT_DIR="${SCRIPT_DIR}" | 15 | +BUILD_DIR="${SCRIPT_DIR}/build" |
| 16 | -BUILD_DIR="${PROJECT_DIR}/build" | 16 | +OUTPUT_DIR="${SCRIPT_DIR}/output" |
| 17 | -OUTPUT_DIR="${PROJECT_DIR}/output" | ||
| 18 | 17 | ||
| 19 | info() { | 18 | info() { |
| 20 | echo "[INFO] $*" | 19 | echo "[INFO] $*" |
| @@ -43,7 +42,7 @@ fi | |||
| 43 | mkdir -p "${BUILD_DIR}" "${OUTPUT_DIR}" | 42 | mkdir -p "${BUILD_DIR}" "${OUTPUT_DIR}" |
| 44 | 43 | ||
| 45 | info "Step 1/3: build custom op library and session_run" | 44 | info "Step 1/3: build custom op library and session_run" |
| 46 | -cmake -S "${PROJECT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release | 45 | +cmake -S "${SCRIPT_DIR}" -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release |
| 47 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" | 46 | cmake --build "${BUILD_DIR}" -j"$(nproc 2>/dev/null || echo 8)" |
| 48 | cmake --install "${BUILD_DIR}" | 47 | cmake --install "${BUILD_DIR}" |
| 49 | 48 | ||
| @@ -1,4 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +set -e | ||
| 3 | + | ||
| 2 | # ---------------------------------------------------------------------------- | 4 | # ---------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| @@ -1,4 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +set -e | ||
| 3 | + | ||
| 2 | # ---------------------------------------------------------------------------- | 4 | # ---------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| @@ -1,4 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +set -e | ||
| 3 | + | ||
| 2 | # ---------------------------------------------------------------------------- | 4 | # ---------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| @@ -251,7 +253,7 @@ for round in $(seq 1 $TEST_ROUNDS); do | |||
| 251 | echo "【第${round}轮测试】" | 253 | echo "【第${round}轮测试】" |
| 252 | 254 | ||
| 253 | bench_output=$(./benchmark_model 1000 50 2>&1) | 255 | bench_output=$(./benchmark_model 1000 50 2>&1) |
| 254 | - echo "$bench_output" | grep -E "Average time|Total time|Throughput" | 256 | + echo "$bench_output" | grep -E "Average time|Total time|Throughput" || true |
| 255 | 257 | ||
| 256 | avg_ms=$(echo "$bench_output" | grep "Average time per iteration" | awk -F'[ :]' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]/) print $i; exit}') | 258 | avg_ms=$(echo "$bench_output" | grep "Average time per iteration" | awk -F'[ :]' '{for(i=1;i<=NF;i++) if($i ~ /^[0-9]/) print $i; exit}') |
| 257 | 259 | ||
| @@ -1,4 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +set -e | ||
| 3 | + | ||
| 2 | # ---------------------------------------------------------------------------- | 4 | # ---------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| @@ -1,4 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +set -e | ||
| 3 | + | ||
| 2 | # ---------------------------------------------------------------------------- | 4 | # ---------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 5 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of | 6 | # This program is free software, you can redistribute it and/or modify it under the terms and conditions of |