Browse Source

fix(mgb): fix wrong set of strategy in lar

GitOrigin-RevId: 5c1f7c669f
release-1.5
Megvii Engine Team 4 years ago
parent
commit
d2e33af52f
2 changed files with 18 additions and 1 deletions
  1. +1
    -1
      sdk/load-and-run/src/mgblar.cpp
  2. +17
    -0
      src/opr/impl/search_policy/algo_chooser.cpp

+ 1
- 1
sdk/load-and-run/src/mgblar.cpp View File

@@ -703,7 +703,7 @@ void run_test_st(Args &env) {


mgb::gopt::set_opr_algo_workspace_limit_inplace(vars, env.workspace_limit); mgb::gopt::set_opr_algo_workspace_limit_inplace(vars, env.workspace_limit);
using S = opr::mixin::AlgoChooserHelper::ExecutionPolicy::Strategy; using S = opr::mixin::AlgoChooserHelper::ExecutionPolicy::Strategy;
S strategy = S::HEURISTIC;
S strategy = static_cast<S>(0);
if (env.reproducible) { if (env.reproducible) {
strategy = S::REPRODUCIBLE; strategy = S::REPRODUCIBLE;
} }


+ 17
- 0
src/opr/impl/search_policy/algo_chooser.cpp View File

@@ -868,6 +868,23 @@ template <typename Opr>
typename AlgoChooser<Opr>::ImplExecutionPolicy AlgoChooser<Opr>::get_policy( typename AlgoChooser<Opr>::ImplExecutionPolicy AlgoChooser<Opr>::get_policy(
const AlgoChooserHelper& helper) { const AlgoChooserHelper& helper) {
auto opr_strategy = helper.execution_policy().strategy; 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::HEURISTIC) {
if (opr_strategy & ExecutionStrategy::PROFILE) { if (opr_strategy & ExecutionStrategy::PROFILE) {
//! this strategy will choose from cache first, then choost by //! this strategy will choose from cache first, then choost by


Loading…
Cancel
Save