From d2e33af52f80e7de177f691d17a0558ebd7ea63d Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Tue, 25 May 2021 19:13:47 +0800 Subject: [PATCH] fix(mgb): fix wrong set of strategy in lar GitOrigin-RevId: 5c1f7c669fa94ad9b1a4d46cfc8ed101b16d98a4 --- sdk/load-and-run/src/mgblar.cpp | 2 +- src/opr/impl/search_policy/algo_chooser.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sdk/load-and-run/src/mgblar.cpp b/sdk/load-and-run/src/mgblar.cpp index 046ecb98b..908bb756e 100644 --- a/sdk/load-and-run/src/mgblar.cpp +++ b/sdk/load-and-run/src/mgblar.cpp @@ -703,7 +703,7 @@ void run_test_st(Args &env) { mgb::gopt::set_opr_algo_workspace_limit_inplace(vars, env.workspace_limit); using S = opr::mixin::AlgoChooserHelper::ExecutionPolicy::Strategy; - S strategy = S::HEURISTIC; + S strategy = static_cast(0); if (env.reproducible) { strategy = S::REPRODUCIBLE; } diff --git a/src/opr/impl/search_policy/algo_chooser.cpp b/src/opr/impl/search_policy/algo_chooser.cpp index 4bf2dc480..57a0d3f61 100644 --- a/src/opr/impl/search_policy/algo_chooser.cpp +++ b/src/opr/impl/search_policy/algo_chooser.cpp @@ -868,6 +868,23 @@ template typename AlgoChooser::ImplExecutionPolicy AlgoChooser::get_policy( const AlgoChooserHelper& helper) { auto opr_strategy = helper.execution_policy().strategy; + auto strategy2str = [](auto strategy) { + std::string ret; + if (strategy & ExecutionStrategy::HEURISTIC) { + ret += "HEURISTIC "; + } + if (strategy & ExecutionStrategy::PROFILE) { + ret += "PROFILE "; + } + if (strategy & ExecutionStrategy::REPRODUCIBLE) { + ret += "REPRODUCIBLE "; + } + if (strategy & ExecutionStrategy::OPTIMIZED) { + ret += "OPTIMIZED "; + } + return ret; + }; + mgb_log_debug("Use Stragegy :%s", strategy2str(opr_strategy).c_str()); if (opr_strategy & ExecutionStrategy::HEURISTIC) { if (opr_strategy & ExecutionStrategy::PROFILE) { //! this strategy will choose from cache first, then choost by -- GitLab