diff --git a/examples/matrix/common_scripts/exec_utils.py b/examples/matrix/common_scripts/exec_utils.py index 08ae4f4e893ef6976b3949802cc2836f6317310b..2eaedf07b06e5df7e3ba2a94d59a16321a26456f 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 05565eb68f41812f7151008eb3b3cc8317d7033e..8a539cfc26d7c52974cb66480f3cafa9c3b5d92d 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 f7a091ab5cb4b113b9c54ee5c881210e7c3c1f86..631f7ba355486162d0c82f5fe28382e91d0c3d45 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 5abde159f6ad8a112abc7e293f75ca48e1d86a26..dc3edb7e56cbee133c51d84f56c9c35c6d2f612a 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 3e72cf06fb9394606393ff09a8db334e83e9fa71..4fceabf67cb94fa5e82534bf5636dbc3544dbb52 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 bd99d4d81df003605fbfe0ba6af360b702c06d30..3933ebf51f6f5202d7bf3642ad3e7ca5189fa667 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 9342fccbf920a47fd4e681f9dc74616c617d8370..dca86b58219e94c77dd65284a4c23e96182467ff 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 70927d007321703558d430b158a7a22fbd075e0a..f80b3277391b51bfb932ea7562e1aaf795b854f3 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 18fb3f9b61e3e7d48b9d0987004b6f0ddeecabe9..505ad20995f41829195d5978ad492e40f2c2b66e 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 f7a091ab5cb4b113b9c54ee5c881210e7c3c1f86..631f7ba355486162d0c82f5fe28382e91d0c3d45 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 c4fa5c677a10028b2ab43796250d34890d124b81..2b109b9862beacba0f9cb273b6214be2248671c1 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 cf28fabefd24ef492fc05c03e7234ae5c90ca502..f3cfe2011c5efcad84b8a8341995b05da219ef45 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 8e10a478ea5010b0e89f4339d46d23a92c428a1c..d4369bd060eb2390ce9310e25c209b1be8701b2f 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 bcdcf7aac3f2ad5b867e1ff54121aa2f9beb1a77..266e12d0c39ac6c65fade34a595c70b2e36d0c70 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}