From 10fc94ddc488a3fe3634d012a8dda9ad64729437 Mon Sep 17 00:00:00 2001 From: li-yuanjie-da Date: Wed, 25 Jun 2025 09:56:01 +0800 Subject: [PATCH] fix error log --- examples/matrix/common_scripts/exec_utils.py | 4 ++-- examples/matrix/matmul_async/run.sh | 2 ++ examples/matrix/matmul_constant/run.sh | 3 +++ examples/matrix/matmul_k_reorder_load/run.sh | 2 ++ examples/matrix/matmul_l0c_extend/run.sh | 2 ++ examples/matrix/matmul_mixdualmaster/run.sh | 2 ++ examples/matrix/matmul_mndb/run.sh | 2 ++ examples/matrix/matmul_nbuffer33/run.sh | 2 ++ examples/matrix/matmul_nz/main.cpp | 13 +++++++++++-- examples/matrix/matmul_nz/run.sh | 3 +++ examples/matrix/matmul_partial_output/run.sh | 2 ++ examples/matrix/matmul_preload/run.sh | 2 ++ examples/matrix/matmul_splitk/run.sh | 2 ++ examples/matrix/matmul_tscm/run.sh | 2 ++ 14 files changed, 39 insertions(+), 4 deletions(-) diff --git a/examples/matrix/common_scripts/exec_utils.py b/examples/matrix/common_scripts/exec_utils.py index 08ae4f4e..2eaedf07 100644 --- a/examples/matrix/common_scripts/exec_utils.py +++ b/examples/matrix/common_scripts/exec_utils.py @@ -85,7 +85,7 @@ def clear_file_cache(file_work_dir): os.system("rm -rf " + rm_files) rm_files = file_work_dir + "/output/*.bin" os.system("rm -rf " + rm_files) - rm_files = file_work_dir + "/build/prof_out/*" + rm_files = file_work_dir + "/bin/prof_out/*" os.system("rm -rf " + rm_files) - rm_files = file_work_dir + "/build/sim_out/*" + rm_files = file_work_dir + "/bin/sim_out/*" os.system("rm -rf " + rm_files) diff --git a/examples/matrix/matmul_async/run.sh b/examples/matrix/matmul_async/run.sh index 05565eb6..8a539cfc 100644 --- a/examples/matrix/matmul_async/run.sh +++ b/examples/matrix/matmul_async/run.sh @@ -89,4 +89,6 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_async_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + python3 -u ../scripts/exec_test.py -r ${RUN_MODE} -p ${IS_PERF} -m ${ASYNC_MODE} diff --git a/examples/matrix/matmul_constant/run.sh b/examples/matrix/matmul_constant/run.sh index f7a091ab..631f7ba3 100644 --- a/examples/matrix/matmul_constant/run.sh +++ b/examples/matrix/matmul_constant/run.sh @@ -79,6 +79,9 @@ rm -rf bin/ mkdir -p bin cd bin cp ../build/ascendc_matmul_bbit ./ + +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_k_reorder_load/run.sh b/examples/matrix/matmul_k_reorder_load/run.sh index 5abde159..dc3edb7e 100644 --- a/examples/matrix/matmul_k_reorder_load/run.sh +++ b/examples/matrix/matmul_k_reorder_load/run.sh @@ -38,6 +38,8 @@ rm -rf build mkdir build cd build +export TF_CPP_MIN_LOG_LEVEL=3 + # in case of running op in simulator, use stub so instead if [ "${RUN_MODE}" = "sim" ]; then export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed 's/\/.*\/runtime\/lib64://g') diff --git a/examples/matrix/matmul_l0c_extend/run.sh b/examples/matrix/matmul_l0c_extend/run.sh index 3e72cf06..4fceabf6 100644 --- a/examples/matrix/matmul_l0c_extend/run.sh +++ b/examples/matrix/matmul_l0c_extend/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_l0c_extend_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_mixdualmaster/run.sh b/examples/matrix/matmul_mixdualmaster/run.sh index bd99d4d8..3933ebf5 100644 --- a/examples/matrix/matmul_mixdualmaster/run.sh +++ b/examples/matrix/matmul_mixdualmaster/run.sh @@ -61,6 +61,8 @@ rm -rf build mkdir build cd build +export TF_CPP_MIN_LOG_LEVEL=3 + source $ASCEND_HOME_DIR/bin/setenv.bash export LD_LIBRARY_PATH=${ASCEND_HOME_DIR}/tools/simulator/${SOC_VERSION}/lib:$LD_LIBRARY_PATH set -euo pipefail diff --git a/examples/matrix/matmul_mndb/run.sh b/examples/matrix/matmul_mndb/run.sh index 9342fccb..dca86b58 100644 --- a/examples/matrix/matmul_mndb/run.sh +++ b/examples/matrix/matmul_mndb/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_mndb_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_nbuffer33/run.sh b/examples/matrix/matmul_nbuffer33/run.sh index 70927d00..f80b3277 100644 --- a/examples/matrix/matmul_nbuffer33/run.sh +++ b/examples/matrix/matmul_nbuffer33/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_nbuffer33_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3s + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_nz/main.cpp b/examples/matrix/matmul_nz/main.cpp index 18fb3f9b..505ad209 100644 --- a/examples/matrix/matmul_nz/main.cpp +++ b/examples/matrix/matmul_nz/main.cpp @@ -29,6 +29,7 @@ namespace { bool IS_BIAS = false; bool IS_A_TRANS = false; bool IS_B_TRANS = false; +int64_t BLOCK_SIZE = 16; } namespace MatmulHost { @@ -38,6 +39,14 @@ static size_t GetSysWorkSpaceSize() return static_cast(ascendcPlatform->GetLibApiWorkSpaceSize()); } +static int64_t Ceil(int64_t a, int64_t b) +{ + if (b == 0) { + return a; + } + return (a + b - 1) / b; +} + // CPU debug mode #ifdef ASCENDC_CPU_DEBUG void TestMatmulCpu(int64_t m, int64_t n, int64_t k) @@ -47,7 +56,7 @@ void TestMatmulCpu(int64_t m, int64_t n, int64_t k) size_t yFileSize = m * n * sizeof(float); size_t biasFileSize = 1 * n * sizeof(float); // Query workspace size, use workspace to keep nz matrix - size_t workspaceSize = GetSysWorkSpaceSize() + static_cast(n * k) * sizeof(uint16_t); + size_t workspaceSize = GetSysWorkSpaceSize() + static_cast(Ceil(n, BLOCK_SIZE) * BLOCK_SIZE * k) * sizeof(uint16_t); uint8_t* x1 = (uint8_t*)AscendC::GmAlloc(x1FileSize); uint8_t* x2 = (uint8_t*)AscendC::GmAlloc(x2FileSize); uint8_t* bias; // IS_BIAS = true @@ -87,7 +96,7 @@ void MatmulOp(uint8_t* x1, uint8_t* x2, uint8_t* y, uint8_t* bias, int64_t m, in uint8_t *workspaceDevice; // Query workspace size, use workspace to keep nz matrix - size_t workspaceSize = GetSysWorkSpaceSize() + static_cast(n * k) * sizeof(uint16_t); + size_t workspaceSize = GetSysWorkSpaceSize() + static_cast(Ceil(n, BLOCK_SIZE) * BLOCK_SIZE * k) * sizeof(uint16_t); // Allocate workspace on device CHECK_ACL(aclrtMalloc((void **)&workspaceDevice, workspaceSize, ACL_MEM_MALLOC_HUGE_FIRST)); diff --git a/examples/matrix/matmul_nz/run.sh b/examples/matrix/matmul_nz/run.sh index f7a091ab..631f7ba3 100644 --- a/examples/matrix/matmul_nz/run.sh +++ b/examples/matrix/matmul_nz/run.sh @@ -79,6 +79,9 @@ rm -rf bin/ mkdir -p bin cd bin cp ../build/ascendc_matmul_bbit ./ + +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_partial_output/run.sh b/examples/matrix/matmul_partial_output/run.sh index c4fa5c67..2b109b98 100644 --- a/examples/matrix/matmul_partial_output/run.sh +++ b/examples/matrix/matmul_partial_output/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_partial_output_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_preload/run.sh b/examples/matrix/matmul_preload/run.sh index cf28fabe..f3cfe201 100644 --- a/examples/matrix/matmul_preload/run.sh +++ b/examples/matrix/matmul_preload/run.sh @@ -87,6 +87,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_preload_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_splitk/run.sh b/examples/matrix/matmul_splitk/run.sh index 8e10a478..d4369bd0 100644 --- a/examples/matrix/matmul_splitk/run.sh +++ b/examples/matrix/matmul_splitk/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_splitk_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} diff --git a/examples/matrix/matmul_tscm/run.sh b/examples/matrix/matmul_tscm/run.sh index bcdcf7aa..266e12d0 100644 --- a/examples/matrix/matmul_tscm/run.sh +++ b/examples/matrix/matmul_tscm/run.sh @@ -80,6 +80,8 @@ mkdir -p bin cd bin cp ../build/ascendc_matmul_tscm_bbit ./ +export TF_CPP_MIN_LOG_LEVEL=3 + if [ "${RUN_MODE}" = "npu" ]; then if [ "${IS_PERF}" = "1" ]; then export ASCEND_TOOLKIT_HOME=${ASCEND_HOME_DIR} -- Gitee