These are chat archives for halide/Halide

27th
Sep 2018
Jing Pu
@jingpu
Sep 27 15:17
I am looking into a test failure when merging the new simplifier (HEAD of the master). I wonder if the new code optimize the "min" operation in the follow example?
if (t1 <= 1) {
...
} else {
   t2 = min(t1, 1)
}
Andrew Adams
@abadams
Sep 27 15:17
It's designed to do that, yes
Is it removing a min that prevents a zero-division or something?
Jing Pu
@jingpu
Sep 27 15:18
where is the code that track the if-else condition?
Andrew Adams
@abadams
Sep 27 15:18
In Simplify.cpp there's learn_lower_bound
which is probably triggering when it hits the if statement for the else case
That happens in Simplify_Stmts.cpp
scoped_truth indirectly calls it once it examines the nature of the boolean condition
or I guess scoped_falsehood in this case, because it's in the else case
So I guess there could be a bug in ScopedFact::learn_false - there are lots of opportunities for off-by-one errors there
Jing Pu
@jingpu
Sep 27 15:22
Is it removing a min that prevents a zero-division or something?
No. It is something, but I think that in that test we need the min operation to extract a bound and pass to a lower-level tool chain. Now we need to follow what the simplifier does for extracting bounds.
Andrew Adams
@abadams
Sep 27 15:23
If you're using boxes_touched on the entire if statement it should respect the effect of the if
But yeah if you're peephole-examining the individual calls, losing the min without known t1 is bounded by the if is going to be challenging
Zalman Stern
@zvookin
Sep 27 19:51
I'll look at the AVX-512 crash that was reported. (Just a heads up in case anyone else is looking at it or was planning to.)
Andrew Adams
@abadams
Sep 27 19:52
:thumbsup: