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

fix(dnn/rdnn): add warmup before profile

GitOrigin-RevId: 7962525e90d80a717b4682f2f666462d49c95b80
上级 58df717e
......@@ -961,7 +961,7 @@ void AlgoChooser<Opr>::AlgoChooserHelper::profile(
continue;
})
if (!cur_rst.valid()) {
mgb_log_warn(
mgb_log_debug(
"timeout when %s; timeout setting: %.3fsec", msg.c_str(),
cur_timeout);
continue;
......
......@@ -304,6 +304,21 @@ typename TimedProfiler<Opr>::TResult TimedProfiler<Opr>::prof_impl(
RealTimer timer;
auto ev_start = cn.create_event(CompNode::Event::NEED_TIMER),
ev_end = cn.create_event(CompNode::Event::NEED_TIMER);
for (int i = 0; i < 5; ++i) {
if_constexpr<opr_supports_preprocess<Opr>()>(
[&](auto _) {
auto&& opr = _(megdnn_opr);
PreprocessFilter<Opr>* pf =
preprocessed_layout.empty() ? nullptr : &prep_flt;
APPLY(opr->exec(args.as_megdnn()..., pf, mdn_workspace), inp_val,
out_val);
},
/* else */
[&](auto _) {
APPLY(_(megdnn_opr)->exec(args.as_megdnn()..., mdn_workspace),
inp_val, out_val);
});
}
ev_start->record();
if_constexpr<opr_supports_preprocess<Opr>()>(
[&](auto _) {
......@@ -327,12 +342,12 @@ typename TimedProfiler<Opr>::TResult TimedProfiler<Opr>::prof_impl(
while (!ev_end->finished()) {
if (timer.get_secs() >= next_report_time) {
#if MGB_ENABLE_GETENV
mgb_log_warn(
mgb_log_debug(
"profiling conv algo %s already took %.3f/%.3f secs"
" (limit can be set by MGB_CONV_PROFILING_TIMEOUT) ",
algo->name(), timer.get_secs(), param.actual_timeout);
#else
mgb_log_warn(
mgb_log_debug(
"profiling conv algo %s already took %.3f/%.3f secs", algo->name(),
timer.get_secs(), param.actual_timeout);
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册