已合并
fix: cleancode #6694
SH_jingsong创建于 6月10日
fix: cleancode #6694
已合并
从已删除 :master合入到cann/ops-transformermaster
共 3 个文件变更+25-5
| @@ -1,3 +1,14 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 3 | +# 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 | ||
| 5 | +# CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 6 | +# Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 7 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 8 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | +# See LICENSE in the root of the software repository for the full text of the License. | ||
| 10 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 11 | + | ||
| 1 | # 性能数据分析脚本 | 12 | # 性能数据分析脚本 |
| 2 | rm result.xlsx | 13 | rm result.xlsx |
| 3 | msprof python3 -m pytest -rA -s test_mixed_quant_sparse_flash_mla_batch.py -v -m ci -W ignore::UserWarning -W ignore::DeprecationWarning 2>&1 | tee res.log | 14 | msprof python3 -m pytest -rA -s test_mixed_quant_sparse_flash_mla_batch.py -v -m ci -W ignore::UserWarning -W ignore::DeprecationWarning 2>&1 | tee res.log |
| @@ -1,4 +1,15 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 3 | +# 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 | ||
| 5 | +# CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 6 | +# Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 7 | +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 8 | +# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 9 | +# See LICENSE in the root of the software repository for the full text of the License. | ||
| 10 | +# ----------------------------------------------------------------------------------------------------------- | ||
| 11 | + | ||
| 12 | +set -euo pipefail | ||
| 2 | 13 | ||
| 3 | # 脚本路径 | 14 | # 脚本路径 |
| 4 | QSMLA_PT_SAVE_SCRIPT="./batch/test_mixed_quant_sparse_flash_mla_pt_save.py" | 15 | QSMLA_PT_SAVE_SCRIPT="./batch/test_mixed_quant_sparse_flash_mla_pt_save.py" |
| @@ -81,7 +92,7 @@ run_batch() { | |||
| 81 | # 根据KEEP_PT决定是否清理pt文件 | 92 | # 根据KEEP_PT决定是否清理pt文件 |
| 82 | if [ "$KEEP_PT" = false ]; then | 93 | if [ "$KEEP_PT" = false ]; then |
| 83 | echo -e "\n===== 清理pt文件(KEEP_PT=false) =====" | 94 | echo -e "\n===== 清理pt文件(KEEP_PT=false) =====" |
| 84 | - rm -rf $PT_SAVE_DIR | 95 | + [ -n "$PT_SAVE_DIR"] && rm -rf $PT_SAVE_DIR |
| 85 | echo "pt文件已清理" | 96 | echo "pt文件已清理" |
| 86 | else | 97 | else |
| 87 | echo -e "\n===== 保留pt文件(KEEP_PT=true)保存在 $PT_SAVE_DIR =====" | 98 | echo -e "\n===== 保留pt文件(KEEP_PT=true)保存在 $PT_SAVE_DIR =====" |
| @@ -198,5 +209,3 @@ case "$COMMAND" in | |||
| 198 | exit 1 | 209 | exit 1 |
| 199 | ;; | 210 | ;; |
| 200 | esac | 211 | esac |
| 201 | - | ||
| 202 | -exit 0 | ||
| @@ -150,8 +150,8 @@ public: | |||
| 150 | topK, loopIdx * trunkLen - QLICommon::Align(topK, (uint32_t)256), s2SeqLen); // 256: 硬件对齐粒度 | 150 | topK, loopIdx * trunkLen - QLICommon::Align(topK, (uint32_t)256), s2SeqLen); // 256: 硬件对齐粒度 |
| 151 | if (loopIdx == s2LoopNum - 1) { | 151 | if (loopIdx == s2LoopNum - 1) { |
| 152 | PipeBarrier<PIPE_V>(); | 152 | PipeBarrier<PIPE_V>(); |
| 153 | - if ((loopIdx + 1) % 2 == 1) { | 153 | + if ((loopIdx + 1) % 2 == 1) { // 1: 直接访问 Bank 1; 2: 双缓冲总数 |
| 154 | - AscendC::DataCopy(indicesOutLocal, hisIndexLocal[(loopIdx + 1) % 2], | 154 | + AscendC::DataCopy(indicesOutLocal, hisIndexLocal[(loopIdx + 1) % 2], // 1: 直接访问 Bank 1; 2: 双缓冲总数 |
| 155 | QLICommon::Align(topK, (uint32_t)256)); // 256: 硬件对齐粒度; 2: 双缓冲的Bank | 155 | QLICommon::Align(topK, (uint32_t)256)); // 256: 硬件对齐粒度; 2: 双缓冲的Bank |
| 156 | } | 156 | } |
| 157 | } | 157 | } |