vollmerm / shallow-fission

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Track size in shallow layer #1

Open rrnewton opened 8 years ago

rrnewton commented 8 years ago

We can't analyze the Exp expressions which often determine size (at least not without wrapping/intercepting everything that builds Exp, which would be like making a whole new EDSL). That kind of stinks, but we can still figure out the sizes of some arrays.

This could be useful for things like determining a policy for divide and conquer, or deciding when not to fission at all.

Alternatively, if we want to focus on run1 instead of run, the goal would not be so much to determine static sizes (impossible), but to generate conditional Accelerate programs that test size and dispatch to precompiled alternatives. One goal would be a run1 version of something like matrix multiply that behaves well on all matrix sizes.

vollmerm commented 8 years ago

This seems doable.

There are some easy cases like mandelbrot, where the work is done in a single generate that has a constant expression as its shape parameter. To make that less trivial, we could have that shape parameter read from an array at runtime.

We could ask the autotuner for some threshold where it's not worth splitting that generate, make two different programs (one that splits, one that doesn't), then dispatch at runtime by comparing the actual size to the tuned threshold.

rrnewton commented 8 years ago

Pushing this off till later because we want to go with run1.