From 588a645b5c1af72e4d51450e1f28a40660423177 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 10 Jun 2022 18:42:39 +0800 Subject: [PATCH] feat(dnn/opencl): add binary interface for opencl algo and kernel cache GitOrigin-RevId: 3c084fafd9f999ab2442fe6b87f80b919bd76fad --- lite/load_and_run/src/options/device_options.cpp | 4 ++++ lite/load_and_run/src/options/device_options.h | 3 +-- lite/load_and_run/src/strategys/strategy_fitting.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lite/load_and_run/src/options/device_options.cpp b/lite/load_and_run/src/options/device_options.cpp index 10152fe2..c1d2dc6f 100644 --- a/lite/load_and_run/src/options/device_options.cpp +++ b/lite/load_and_run/src/options/device_options.cpp @@ -155,6 +155,8 @@ XPUDeviceOption::XPUDeviceOption() { thread_cnt == thread_num, "core ids number should be same with thread number set before"); enable_set_core_ids = true; + } else { + enable_set_core_ids = false; } m_option = { @@ -237,6 +239,8 @@ void XPUDeviceOption::config_model( thread_cnt == thread_num, "core ids number should be same with thread number set before"); enable_set_core_ids = true; + } else { + enable_set_core_ids = false; } CONFIG_MODEL_FUN; diff --git a/lite/load_and_run/src/options/device_options.h b/lite/load_and_run/src/options/device_options.h index 5d70e668..bb61aedd 100644 --- a/lite/load_and_run/src/options/device_options.h +++ b/lite/load_and_run/src/options/device_options.h @@ -17,8 +17,7 @@ class XPUDeviceOption final : public OptionBase { public: static bool is_valid(); static std::shared_ptr create_option(); - void config_model( - RuntimeParam& runtime_param, std::shared_ptr model) override; + void config_model(RuntimeParam&, std::shared_ptr) override; std::string option_name() const override { return m_option_name; }; static void set_valid(bool val) { m_valid = val; } diff --git a/lite/load_and_run/src/strategys/strategy_fitting.cpp b/lite/load_and_run/src/strategys/strategy_fitting.cpp index 794d3760..d7d1dc1c 100644 --- a/lite/load_and_run/src/strategys/strategy_fitting.cpp +++ b/lite/load_and_run/src/strategys/strategy_fitting.cpp @@ -160,6 +160,7 @@ void OptionsTimeProfiler::profile_with_given_options( mgb::RealTimer timer; auto stage_config_model = [&]() { for (auto& option : *given_options) { + mgb_assert(option.second, "invalid option %s\n", option.first.c_str()); option.second->config_model(runtime_param, model); } }; @@ -456,7 +457,6 @@ void FittingStrategy::dump_best_options_with_model() { } model->run_model(); model->wait(); - std::vector model_data = model->get_model_data(); mgb_log_warn("model_data size=%zu", model_data.size()); mgb_log_warn("json_info size=%zu", json_info.size()); @@ -465,7 +465,7 @@ void FittingStrategy::dump_best_options_with_model() { lite::ModelPacker packer( model_data, m_dumped_model, json_info, info_algo_policy_data, info_binary_cache_data); - packer.set_header(); + packer.set_header("NONE", "NONE", info_binary_cache_data.empty()); packer.pack_model(); } ///////////////////////// AutoCleanFile/////////////////////////// -- GitLab