提交 588a645b 编写于 作者: M Megvii Engine Team

feat(dnn/opencl): add binary interface for opencl algo and kernel cache

GitOrigin-RevId: 3c084fafd9f999ab2442fe6b87f80b919bd76fad
上级 1192a9a6
...@@ -155,6 +155,8 @@ XPUDeviceOption::XPUDeviceOption() { ...@@ -155,6 +155,8 @@ XPUDeviceOption::XPUDeviceOption() {
thread_cnt == thread_num, thread_cnt == thread_num,
"core ids number should be same with thread number set before"); "core ids number should be same with thread number set before");
enable_set_core_ids = true; enable_set_core_ids = true;
} else {
enable_set_core_ids = false;
} }
m_option = { m_option = {
...@@ -237,6 +239,8 @@ void XPUDeviceOption::config_model( ...@@ -237,6 +239,8 @@ void XPUDeviceOption::config_model(
thread_cnt == thread_num, thread_cnt == thread_num,
"core ids number should be same with thread number set before"); "core ids number should be same with thread number set before");
enable_set_core_ids = true; enable_set_core_ids = true;
} else {
enable_set_core_ids = false;
} }
CONFIG_MODEL_FUN; CONFIG_MODEL_FUN;
......
...@@ -17,8 +17,7 @@ class XPUDeviceOption final : public OptionBase { ...@@ -17,8 +17,7 @@ class XPUDeviceOption final : public OptionBase {
public: public:
static bool is_valid(); static bool is_valid();
static std::shared_ptr<OptionBase> create_option(); static std::shared_ptr<OptionBase> create_option();
void config_model( void config_model(RuntimeParam&, std::shared_ptr<ModelBase>) override;
RuntimeParam& runtime_param, std::shared_ptr<ModelBase> model) override;
std::string option_name() const override { return m_option_name; }; std::string option_name() const override { return m_option_name; };
static void set_valid(bool val) { m_valid = val; } static void set_valid(bool val) { m_valid = val; }
......
...@@ -160,6 +160,7 @@ void OptionsTimeProfiler::profile_with_given_options( ...@@ -160,6 +160,7 @@ void OptionsTimeProfiler::profile_with_given_options(
mgb::RealTimer timer; mgb::RealTimer timer;
auto stage_config_model = [&]() { auto stage_config_model = [&]() {
for (auto& option : *given_options) { for (auto& option : *given_options) {
mgb_assert(option.second, "invalid option %s\n", option.first.c_str());
option.second->config_model(runtime_param, model); option.second->config_model(runtime_param, model);
} }
}; };
...@@ -456,7 +457,6 @@ void FittingStrategy::dump_best_options_with_model() { ...@@ -456,7 +457,6 @@ void FittingStrategy::dump_best_options_with_model() {
} }
model->run_model(); model->run_model();
model->wait(); model->wait();
std::vector<uint8_t> model_data = model->get_model_data(); std::vector<uint8_t> model_data = model->get_model_data();
mgb_log_warn("model_data size=%zu", model_data.size()); mgb_log_warn("model_data size=%zu", model_data.size());
mgb_log_warn("json_info size=%zu", json_info.size()); mgb_log_warn("json_info size=%zu", json_info.size());
...@@ -465,7 +465,7 @@ void FittingStrategy::dump_best_options_with_model() { ...@@ -465,7 +465,7 @@ void FittingStrategy::dump_best_options_with_model() {
lite::ModelPacker packer( lite::ModelPacker packer(
model_data, m_dumped_model, json_info, info_algo_policy_data, model_data, m_dumped_model, json_info, info_algo_policy_data,
info_binary_cache_data); info_binary_cache_data);
packer.set_header(); packer.set_header("NONE", "NONE", info_binary_cache_data.empty());
packer.pack_model(); packer.pack_model();
} }
///////////////////////// AutoCleanFile/////////////////////////// ///////////////////////// AutoCleanFile///////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册