In some cases ops with smaller inputs is executed slower than the one
with larger inputs, more likely because of a backend's load difference.
In such cases result of lin-interpolation is negative, which is wrong
Signed-off-by: Dilshodzhon Poshshoev <d.poshshoev@samsung.com>
int64_t interpolated_value = y0 + (x - x0) * (y1 - y0) / (x1 - x0);
+ // In some cases ops with smaller inputs is executed slower than the one
+ // with larger inputs, more likely because of a backend's load difference
+ if (interpolated_value < 0 && x > x1)
+ {
+ return y0;
+ }
+ // It must be non-positive ONLY if it's lesser than both of them
+ assert(interpolated_value > 0 || x < x0);
+
// execution time must be non-negative
return std::max<int64_t>(interpolated_value, 1);
}