已合并
fix: cleancode #6694
SH_jingsong创建于 6月10日
fix: cleancode #6694
已合并
SH_jingsong创建于 6月10日
已删除 :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# 性能数据分析脚本
2rm result.xlsx13rm result.xlsx
3msprof 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.log14msprof 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/bash1#!/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# 脚本路径
4QSMLA_PT_SAVE_SCRIPT="./batch/test_mixed_quant_sparse_flash_mla_pt_save.py"15QSMLA_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 ]; then93 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_DIR95+ [ -n "$PT_SAVE_DIR"] && rm -rf $PT_SAVE_DIR
85 echo "pt文件已清理"96 echo "pt文件已清理"
86 else97 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 1209 exit 1
199 ;;210 ;;
200esac211esac
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: 双缓冲的Bank155 QLICommon::Align(topK, (uint32_t)256)); // 256: 硬件对齐粒度; 2: 双缓冲的Bank
156 }156 }
157 }157 }