Memory stride effect. Given the following array declarations: real a(5,10) float a[5][10] With a computer which uses interleaved memory with 6 banks (for a simplified model), fill in the diagram to show where the different elements of "a" are placed bank0 bank1 bank2 bank3 bank4 bank5 ------- ------- ------- ------- ------- ------ a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] a[0][5] a[0][6] a[0][7] a[0][8] a[0][9] a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] a[1][5] a[1][6] a[1][7] a[1][8] a[1][9] a[2][0] a[2][1] a[2][2] a[2][3] a[2][4] a[2][5] a[2][6] a[2][7] a[2][8] a[2][9] a[3][0] a[3][1] a[3][2] a[3][3] a[3][4] a[3][5] a[3][6] a[3][7] a[3][8] a[3][9] a[4][0] a[4][1] a[4][2] a[4][3] a[4][4] a[4][5] a[4][6] a[4][7] a[4][8] a[4][9] =========================================================================== Drawing a Gantt chart (e.g. p. 18 text) for accessing row4: instruction: a[3][4](b4) a[3][3](b3) a[3][2](b2) a[3][1](b1) a[3][0](b0) -------|----------|----------|----------|----------|------ clock 1 2 3 4 5 Assuming a 6 clock time to load memory from a bank, we will have no stalls. What if the time to load took 8 clocks? Still no stalls since we only have 5 elements to load and they are in separate memory banks. =========================================================================== Drawing Gantt Chart (e.g. p. 18 text) for accessing column2: instruction: a[5][1](b6) a[4][1](b3) a[3][1](b1) a[2][1](b3) a[1][1](b5) a[0][1](b1) -------|----------|----------|----------|----------|----------|----------|----- clock 1 2 3 4 5 6 7 Assuming a 6 block time time to load memory from a bank, we will have a stall on trying to load a[3][1] since Bank 1 is not available yet. ============================================================================== Let's look at Fortran, which stores by columns: bank0 bank1 bank2 bank3 bank4 bank5 ------- ------- ------- ------- ------- ------ a(1,1) a(2,1) a(3,1) a(4,1) a(5,1) a(1,2) a(2,2) a(3,2) a(4,2) a(5,2) a(1,3) a(2,3) a(3,3) a(4,3) a(5,3) a(1,4) a(2,4) a(3,4) a(4,4) a(5,4) a(1,5) a(2,5) a(3,5) a(4,5) a(5,5) a(1,6) a(2,6) a(3,6) a(4,6) a(5,6) a(1,7) a(2,7) a(3,7) a(4,7) a(5,7) a(1,8) a(2,8) a(3,8) a(4,8) a(5,8) a(1,9) a(2,9) a(3,9) a(4,9) a(5,9) a(1,10) a(2,10) a(3,10) a(4,10) a(5,10) ========================================================================= What would happen when we access row 4 [a(4,*)]? What would happen when we access column 2 [a(*,2)]? Continued Later ...