Re: belated feedback Bradley Lucier 17 Apr 2021 01:10 UTC

On 4/16/21 8:03 PM, Alex Shinn wrote:
> Hi Bradley,
>
> Sorry, my explanation of that hack was brief, mostly because it was
> only a hack.  The key comment was:
>
>    "However, I intend to flatten all of the affine transformations
> next, at which point I'll need to implement this properly."
>
> The entire point of composing affine transformations is that their
> composition is another affine transformation, so the indexer never
> grows in complexity.  In particular, for a 2D matrix this
> transformation is just a matter of strides, which means BLAS can
> multiply any SRFI 179 f32 or f64 vectors.

OK, sorry, I said I didn't understand this statement, and it turned out
to be critical!

> 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.

Brad