Suppose we had the following:
Var idx;
Func out;
out(idx) = select(idx == 0, VAL_1, select(idx == 1, VAL_2, VAL3));
It would be nice to be able to force Halide to use if/then/else constructs for this in the loop body, instead of selects. I was assuming that this is done using the specialize() scheduling command:
out.specialize(idx == 0);
out.specialize(idx == 1);
However, this seems to be forbidden:
"Error at (...): Specialization condition (...) depends on Var or RVar idx.
Specialization conditions may not depend on any Vars or RVars.
Is there a particular reason why this limitation exists? Or maybe some other way to reach the intended behavior, other than unrolling?
Thanks and kind regards,
Sander