Tue Feb 19 19:24:40 CET 2013


It's an interesting feature, but it remains a bit strange.  Maybe
"implicit" is the word.  Implicit might be good for programming, but
not really for compiling.

It might be that I'm a bit overambitious after the preliminary success.

But, otoh, a syntax of binding array outputs makes a lot of sense.

I.e. inside a loop, all temporaries are scalars, but those that make
it to the outside as input/output/state will be indexed bindings.

This means that the algorithm is essentially two-pass:
- node expansion / type inference in parallel
- index annotation

While const stuff needs wildcards to be lifted to the grid type of a
loop, the intermediates take the type of the other expressons in the

They are actually grids.  The only difference is that their values are
not retained to the next loop iteration.

Anyways, just chugging along I get something like this:

(let-values ((((v12))         (p_mul (v10 i j) (v2 i j)))
             (((v13))         (p_mul (v11 i j) (v3 i j)))
             (((v14))         (p_add v12 v13))
             ((((v15 i j)))   (p_add v14 (v0 i j)))
             (((v16))         (p_mul (v10 i j) (v4 i j)))
             (((v17))         (p_mul (v11 i j) (v5 i j)))
             (((v18))         (p_add v16 v17))
             ((((v19 i j)))   (p_add v18 (v1 i j)))
             (((v22))         (p_add v20 (v15 i j)))
             (((v23))         (p_add v21 (v19 i j))))

Something not right with the parenthesis but it looks ok.  All binding
forms that have indices are actually assignments to externally
provided grids.

It's probably also better to use array indexing like this, and give
the C compiler access to the structure of the state.  Also better for