From 1132af81e2aaa13cf3de56e458df446a93527d92 Mon Sep 17 00:00:00 2001 From: liuqi Date: Tue, 26 Jun 2018 19:40:00 +0800 Subject: [PATCH] Fix concat and slice benchmark bug. --- mace/kernels/opencl/concat.cc | 2 +- mace/kernels/opencl/slice.cc | 2 +- tools/converter.py | 1 + tools/sh_commands.py | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mace/kernels/opencl/concat.cc b/mace/kernels/opencl/concat.cc index 4ccb42a1..65540e48 100644 --- a/mace/kernels/opencl/concat.cc +++ b/mace/kernels/opencl/concat.cc @@ -214,7 +214,7 @@ static MaceStatus ConcatN(cl::Kernel *kernel, MACE_CHECK(*kerror_code == 0) << "Kernel error code: " << *kerror_code; (*kernel_error)->UnMap(); } - if (runtime->is_profiling_enabled()) { + if (future != nullptr && runtime->is_profiling_enabled()) { event.wait(); CallStats tmp_stats; runtime->GetCallStats(event, &tmp_stats); diff --git a/mace/kernels/opencl/slice.cc b/mace/kernels/opencl/slice.cc index f865091f..160ad003 100644 --- a/mace/kernels/opencl/slice.cc +++ b/mace/kernels/opencl/slice.cc @@ -114,7 +114,7 @@ MaceStatus SliceFunctor::operator()( MACE_CHECK(*kerror_code == 0) << "Kernel error code: " << *kerror_code; kernel_error_->UnMap(); } - if (runtime->is_profiling_enabled()) { + if (future != nullptr && runtime->is_profiling_enabled()) { event.wait(); CallStats tmp_stats; runtime->GetCallStats(event, &tmp_stats); diff --git a/tools/converter.py b/tools/converter.py index ea212ec9..3a8d0276 100644 --- a/tools/converter.py +++ b/tools/converter.py @@ -808,6 +808,7 @@ def build_specific_lib(target_abi, target_soc, serial_num, sh_commands.build_benchmark_model(target_abi, build_tmp_binary_dir, hexagon_mode, + enable_openmp, linkshared) # generate library diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 3e231ca8..df23c488 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -1051,16 +1051,17 @@ def packaging_lib(libmace_output_dir, project_name): def build_benchmark_model(abi, model_output_dir, hexagon_mode, + enable_openmp, linkshared=False): - if linkshared == 0: + if not linkshared: target_name = "benchmark_model_static" else: target_name = "benchmark_model_shared" - benchmark_target = "//mace/benchmark:benchmark_model_shared" benchmark_target = "//mace/benchmark:%s" % target_name bazel_build(benchmark_target, abi=abi, + enable_openmp=enable_openmp, hexagon_mode=hexagon_mode) benchmark_binary_file = "%s/%s" % (model_output_dir, target_name) -- GitLab