Open abadams opened 9 years ago
I think we have the ability to detect most potential integer/fixed point overflow issues using interval arithmetic. We could warn on things like:
ImageParam a(UInt(8), 1), b(UInt(8), 1);
f(x) = a(x) + b(x); // 8-bit overflow!
but not warn on things like:
f(x) = (a(x) % 64) * min(b(x), 4); // max possible value is 63*4
We'd need a clean way to tell Halide that a warning is a false positive though.
This is a feature request from someone who works with integer pipelines a lot and sometimes has bugs where they forget to upcast before a multiply.
I think we have the ability to detect most potential integer/fixed point overflow issues using interval arithmetic. We could warn on things like:
ImageParam a(UInt(8), 1), b(UInt(8), 1);
f(x) = a(x) + b(x); // 8-bit overflow!
but not warn on things like:
f(x) = (a(x) % 64) * min(b(x), 4); // max possible value is 63*4
We'd need a clean way to tell Halide that a warning is a false positive though.