On Sat, Apr 17, 2021 at 10:10 AM Bradley Lucier <xxxxxx@math.purdue.edu> wrote:
>
> On 4/16/21 8:03 PM, Alex Shinn wrote:
>
> > What surprised me most is that after completing my work and looking at
> > the reference implementation, the latter does not seem to perform this
> > optimization. In fact, the array record type only holds the indexer,
> > not the affine coefficients, so it cannot perform this optimization
> > (unless the compiler is smart enough to combine these closures at
> > runtime).
>
> The strides, lower bounds, and base index are implicit in the closures
> that implement the indexers in %%indexer-1/2/3/4/generic. It's not the
> compiler that computes these parameters, it's code in
> %%compose-indexers. Perhaps there's a better way.
Ah, sorry, I missed that. You can just call the indexer on the first few values
to get the strides, very elegant. For my own implementation since I want to
tie in with the FFI I will want to make the strides more explicit though.
--
Alex