提交 cd275bf7 编写于 作者: 李寅

Merge branch 'update_benchmark_flow' into 'master'

update benchmark and build mace_run flow

See merge request !441
......@@ -217,15 +217,15 @@ def build_mace_run_prod(hexagon_mode, runtime, target_abi,
tuning_run(runtime, target_abi, serialno, vlog_level, embed_model_data,
model_output_dir, input_nodes, output_nodes, input_shapes,
output_shapes, model_name, device_type, running_round=0,
restart_round=1, out_of_range_check=True,
phone_data_dir=phone_data_dir, tuning=False)
restart_round=1, out_of_range_check=False,
phone_data_dir=phone_data_dir, tuning=tuning,
limit_opencl_kernel_time=limit_opencl_kernel_time)
tuning_run(runtime, target_abi, serialno, vlog_level, embed_model_data,
model_output_dir, input_nodes, output_nodes, input_shapes,
output_shapes, model_name, device_type, running_round=0,
restart_round=1, out_of_range_check=False,
phone_data_dir=phone_data_dir, tuning=tuning,
limit_opencl_kernel_time=limit_opencl_kernel_time)
restart_round=1, out_of_range_check=True,
phone_data_dir=phone_data_dir, tuning=False)
gen_opencl_and_tuning_code(target_abi, serialno, [model_output_dir],
True)
......@@ -394,6 +394,9 @@ def process_models(project_name, configs, embed_model_data, vlog_level,
if os.path.exists(model_output_dir):
sh.rm("-rf", model_output_dir)
os.makedirs(model_output_dir)
if FLAGS.mode == "build" or FLAGS.mode == "benchmark" or \
FLAGS.mode == "all":
sh_commands.clear_mace_run_data(
target_abi, serialno, phone_data_dir)
......@@ -428,6 +431,8 @@ def process_models(project_name, configs, embed_model_data, vlog_level,
embed_model_data,
model_config["fast_conv"],
model_config["obfuscate"])
if FLAGS.mode == "build" or FLAGS.mode == "all":
build_mace_run_prod(hexagon_mode,
model_config["runtime"],
target_abi,
......@@ -467,6 +472,8 @@ def process_models(project_name, configs, embed_model_data, vlog_level,
phone_data_dir)
if FLAGS.mode == "benchmark":
gen_opencl_and_tuning_code(
target_abi, serialno, [model_output_dir], False)
sh_commands.benchmark_model(target_abi,
serialno,
vlog_level,
......
......@@ -528,8 +528,10 @@ def tuning_run(abi,
option_args="",
input_file_name="model_input",
output_file_name="model_out"):
print("* Run '%s' with round=%s, restart_round=%s, tuning=%s" %
(model_tag, running_round, restart_round, str(tuning)))
print("* Run '%s' with round=%s, restart_round=%s, tuning=%s, "
"out_of_range_check=%s" %
(model_tag, running_round, restart_round, str(tuning),
str(out_of_range_check)))
if abi == "host":
p = subprocess.Popen([
"env",
......@@ -750,10 +752,9 @@ def merge_libs(target_soc,
sh.cp("-f", hexagon_lib_file, model_bin_dir)
mri_stream = ""
mri_stream += "create %s/libmace_%s.%s.a\n" % \
(model_bin_dir, project_name, target_soc)
if abi == "host":
mri_stream += "create %s/libmace_%s.a\n" % \
(model_bin_dir, project_name)
mri_stream += (
"addlib "
"bazel-bin/mace/codegen/libgenerated_opencl.pic.a\n")
......@@ -761,6 +762,8 @@ def merge_libs(target_soc,
"addlib "
"bazel-bin/mace/codegen/libgenerated_tuning_params.pic.a\n")
else:
mri_stream += "create %s/libmace_%s.%s.a\n" % \
(model_bin_dir, project_name, target_soc)
mri_stream += (
"addlib "
"bazel-bin/mace/codegen/libgenerated_opencl.a\n")
......@@ -861,6 +864,7 @@ def benchmark_model(abi,
bazel_build(benchmark_target,
abi=abi,
model_tag=model_tag,
production_mode=True,
hexagon_mode=hexagon_mode)
target_bin = "/".join(bazel_target_to_bin(benchmark_target))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册