Skip to content

August log

root edited this page Aug 1, 2018 · 1 revision

2018 August 1st

Differentiating between loops in nested loop unroll

We now have a reasonably confident way to determine the single dimension array access of a logical multi-dimensional counterpart, and a method to find the set of banks we can access dynamically.

Let's see if we can observe changes to bank access by unrolling in a different dimension.

a: float[3][3] bank(3)

for (let i = 0..3) unroll 3 {
  for (let j = 0..3) {
    access(a[i][j])
  }
}

would require banking in terms of the 1st dimension and

a: float[3][3] bank(3)

for (let i = 0..3) {
  for (let j = 0..3) unroll 3 {
    access(a[i][j])
  }
}

would require banking in 2nd dimension.

For the 1st instance, we can rewrite the array access as,
$$ a[\langle s_i,d_i \rangle][\langle s_j,d_j \rangle] | s_i \in 0..3, d_i \in 0..1, s_j \in 0..1, d_j \in 0..3 $$

for a set of dynamic components ${0,2}$,
we'd access elements ${2,5,8}$

For the 2nd instance, we can rewrite the array access as,
$$ a[\langle s_i,d_i \rangle][\langle s_j,d_j \rangle] | s_i \in 0..1, d_i \in 0..3, s_j \in 0..3, d_j \in 0..1 $$

for a set of dynamic components ${2,0}$,
we'd access elements ${6,7,8}$

This is exactly what we want by index types. However, we need a neat way to bank the single dimensional arrays to reflect the anticipated memory layout by index types.

An earlier suggestion for this was respectively,

a: float[3 bank(3)][3 bank(1)]

and

a: float[3 bank(1)][3 bank(3)]