SegmentedFunction and ArgExtFunction should not store dtypes
@mattwala Since numpy dtypes don't pickle well without some help, all loopy dtypes must carry
a reference to the kernel's Target
. Since that's not guaranteed to be true at kernel
creation, the routine prepare_for_caching
adds them after the fact. Right now, it just
needs to traverse arguments and temp variables. prepare_for_caching
runs on entry
and exit to every cacheable operation, so not rarely. If we have to store dtypes in
the expression tree, that would mean that prepare_for_caching
would need to a full
expression traversal every time, which I'd prefer to avoid.
If you must refer to a dtype from within an expression, doing so by name is the less invasive option.
As it is, argmin reduction seems mostly broken because of this, as in the attached example.