Fri May 17 08:33:03 EDT 2019
I now have:
escapes :: Context Let -> Array -> Bool
So the coordinate transformation should be straightforward to
implement. If an array does not escape, remove all loop indices.
I'm not actually sure that is the whole picture, so let's implement it
Ok the basic idea works!
But one thing I missed: it is not just a local substitution, because
all references need to be substituted.
EDIT: Doing it in two steps: make a list of intermediate
(non-escaping) variables, and use it to perform a substitution.
C <- Aij Bij
Dij <- C Aij
E <- Aij Dij
Together with fusion, this is the basic thing I need. I don't think
that hoistable things would show up in generated code, and
interchange, well I don't really see a way to add a cost function.
It's time to start making some examples that use intermediate arrays,
which is the whole point of this.
This will only make sense when there are folds involved, because
otherwise it would be possible to fuse.
So I need another operator that uses "trangular access" and "feedback
access" and show that this cannot be fused.
These two seem different. Do "feedback access" first.