From bd65c45b6f664e70f97655d882e3b1a873527c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=94=80?= Date: Sun, 20 Jul 2025 16:05:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=94=B9?= =?UTF-8?q?=E5=85=A5=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jenkins/check/config/filter_pylint.txt | 1 + mindspore-lite/test/st/ops/frame/optest.py | 4 ++-- mindspore-lite/test/st/ops/op/run.py | 13 +++++++------ .../test/st/scripts/experimental/context.py | 1 + .../test/st/scripts/run_benchmark_arm64.sh | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.jenkins/check/config/filter_pylint.txt b/.jenkins/check/config/filter_pylint.txt index 8fc5a905..941cc5d0 100644 --- a/.jenkins/check/config/filter_pylint.txt +++ b/.jenkins/check/config/filter_pylint.txt @@ -14,6 +14,7 @@ "mindspore-lite/mindspore-lite/test/st/python/test_large_model_inference.py" "redefined-outer-name" "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/ascendc/cmake/util/insert_simplified_keys.py" "duplicate-key" "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/ascendc/cmake/util/replay_codegen.py" "bad-continuation" +"mindspore-lite/mindspore-lite/test/st/ops/frame/optest.py" "invalid-name" # ascend samples "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/tbe_dsl/sample/" "wrong-import-order" diff --git a/mindspore-lite/test/st/ops/frame/optest.py b/mindspore-lite/test/st/ops/frame/optest.py index 280a566a..414f22c2 100644 --- a/mindspore-lite/test/st/ops/frame/optest.py +++ b/mindspore-lite/test/st/ops/frame/optest.py @@ -10,7 +10,7 @@ from onnx import helper import numpy as np class OpTest: - def __init__(self, config_file, output_path): + def __init__(self, config_file, output_path, package_path): self.config_file = config_file self.model_configs = conf.OnnxModelConfig(self.config_file) self.golden_confis = conf.GenGoldConfig(self.config_file) @@ -21,7 +21,7 @@ class OpTest: self.failed_test_name = [] self.failed_gold_in = [] self.ms_onnx_convert_reverse_dict = {} - mslite_package_path = os.getenv("MSLITE_PACKAGE_PATH") + mslite_package_path = package_path if mslite_package_path is None: raise Exception( diff --git a/mindspore-lite/test/st/ops/op/run.py b/mindspore-lite/test/st/ops/op/run.py index 36903b32..9579cb86 100644 --- a/mindspore-lite/test/st/ops/op/run.py +++ b/mindspore-lite/test/st/ops/op/run.py @@ -6,7 +6,7 @@ import configs as conf -def run_all(output_path): +def run_all(output_path, package): current_directory = os.getcwd() current_directory = current_directory+"/ops/op" op_directories = [ @@ -29,7 +29,7 @@ def run_all(output_path): total_onnx_op_num += len(yaml_files) for yaml_file in yaml_files: yaml_path = current_directory + "/" + op_ + "/" + yaml_file - conv_test_suit = optest.OpTest(yaml_path, output_path) + conv_test_suit = optest.OpTest(yaml_path, output_path, package) conv_test_suit.exec_st() total_test_num += conv_test_suit.test_nums total_success_num += conv_test_suit.num_success @@ -49,7 +49,7 @@ def run_all(output_path): file.write("\n") -def run_one(output_path, op_name): +def run_one(output_path, op_name, package): current_directory = os.getcwd() op_dir = os.path.join(current_directory+"/ops/op", op_name) yaml_files = [f for f in os.listdir(op_dir) if f.endswith(".yaml")] @@ -59,7 +59,7 @@ def run_one(output_path, op_name): total_failed_gold_in = [] for yaml_file in yaml_files: yaml_path = op_dir + "/" + yaml_file - conv_test_suit = optest.OpTest(yaml_path, output_path) + conv_test_suit = optest.OpTest(yaml_path, output_path, package) conv_test_suit.exec_st() total_test_num += conv_test_suit.test_nums total_success_num += conv_test_suit.num_success @@ -76,15 +76,16 @@ if __name__ == "__main__": parser.add_argument("-a", "--all", action="store_true", help="是否测试全部算子") parser.add_argument("-o", "--output", type=str, help="输出路径", required=True) parser.add_argument("-n", "--name", type=str, help="测试算子名称") + parser.add_argument("-p", "--package", type=str, help="二进制包路径") args = parser.parse_args() if args.all and (args.name is not None): print("Can't set -a and -n same time!") start_time = time.time() if args.all: - run_all(args.output) + run_all(args.output, args.package) else: - run_one(args.output, args.name) + run_one(args.output, args.name, args.package) end_time = time.time() execution_time = end_time - start_time print(f"cost time: {execution_time:.6f} s") diff --git a/mindspore-lite/test/st/scripts/experimental/context.py b/mindspore-lite/test/st/scripts/experimental/context.py index 03ee1981..e1e0bcd0 100644 --- a/mindspore-lite/test/st/scripts/experimental/context.py +++ b/mindspore-lite/test/st/scripts/experimental/context.py @@ -206,6 +206,7 @@ class Context: if not self.work_dir: self.work_dir = os.path.join(self.data_dir, "test_workspace") self.package_path = os.path.join(args.pkg_dir) + self.package_path = os.path.realpath(self.package_path) self.config_file = os.path.join(args.config_file) self.mode = TestMode.from_str(args.test_mode) self.exit_on_failed = args.exit_on_failed diff --git a/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh b/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh index 2b1b8573..9cf4e47b 100644 --- a/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh +++ b/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh @@ -249,7 +249,7 @@ adb -s ${device_id} shell "rm -rf /data/local/tmp/benchmark_test/*" echo "Run_arm64_fp32 and Run_arm64_fp16 single op st" cd ${MSLITE_OPST_PATH} || exit 1 cur_path=$(pwd) -PYTHONPATH=$cur_path/ops/frame python3 $cur_path/ops/op/run.py -o $cur_path/ops/output -a +PYTHONPATH=$cur_path/ops/frame python3 $cur_path/ops/op/run.py -o $cur_path/ops/output -p ${x86_path}/mindspore-lite-${version}-linux-x64/ -a op_st_output=$cur_path/ops/failed_tmp.txt line=$(cat "$op_st_output") echo $line -- Gitee