#include <fstream>
#include <cassert>
#include <limits>
+#include <algorithm>
namespace neurun
{
void ExecTime::updateOperationExecTime(const Backend *backend, const std::string &operation,
bool quant, uint32_t op_size, int64_t time)
{
- // NOTE Use map::insert() instaed of [] operator
- // because of bug on gnu buildtool 6.x -O optimization (coverage test build)
- //_measurements[backend][operation][quant][op_size] = time;
- _measurements[backend][operation][quant].emplace(op_size, time);
+ // If the op is not implemented for some input, it should not be scheduled
+ const auto &recs = _measurements[backend][operation][quant];
+ if (time == getMax() ||
+ std::any_of(recs.begin(), recs.end(),
+ [](std::pair<const uint32_t, const int64_t> p) { return p.second == getMax(); }))
+ {
+ _measurements[backend][operation][quant].clear();
+ _measurements[backend][operation][quant].emplace(op_size, getMax());
+ }
+ else
+ {
+ // NOTE Use map::emplace() instead of operator[]
+ // because of bug on gnu buildtool 6.x -O optimization (coverage test build)
+ //_measurements[backend][operation][quant][op_size] = time;
+ _measurements[backend][operation][quant].emplace(op_size, time);
+ }
}
void ExecTime::updatePermuteTime(const Backend *from_backend, const Backend *to_backend, bool quant,