Skip to content

Commit cb4988d

Browse files
committed
changed back to broken two-dimensional tile array to demonstrate issue
1 parent 3915fab commit cb4988d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/top/java/matrix/fast/TiledFastMatrix.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public <DIMENSION extends Dimension> Matrix<ROWS, DIMENSION> times(Matrix<COLUMN
7171
final int TILE_SIZE = tileSize;
7272
Kernel kernel = new Kernel()
7373
{
74-
@Local final float[] tileA = new float[TILE_SIZE*TILE_SIZE];
75-
@Local final float[] tileB = new float[TILE_SIZE*TILE_SIZE];
74+
@Local final float[][] tileA = new float[TILE_SIZE][TILE_SIZE];
75+
@Local final float[][] tileB = new float[TILE_SIZE][TILE_SIZE];
7676

7777
@Override
7878
public void run()
@@ -88,16 +88,16 @@ public void run()
8888
{
8989
@Constant int tiledRow = TILE_SIZE*tile + localRow;
9090
@Constant int tiledColumn = TILE_SIZE*tile + localColumn;
91-
tileA[localColumn*TILE_SIZE + localRow] = A[tiledColumn*numberOfRows + row];
92-
tileB[localColumn*TILE_SIZE + localRow] = B[column*numberOfColumns + tiledRow];
91+
tileA[localColumn][localRow] = A[tiledColumn*numberOfRows + row];
92+
tileB[localColumn][localRow] = B[column*numberOfColumns + tiledRow];
9393

9494
// Ensure that the entire tile is loaded before starting the computation:
9595
//
9696
localBarrier();
9797

9898
for (int repeat = 0; repeat < TILE_SIZE; repeat++)
9999
{
100-
value += tileA[repeat*TILE_SIZE + localRow] * tileB[localColumn*TILE_SIZE + repeat];
100+
value += tileA[repeat][localRow] * tileB[localColumn][repeat];
101101
}
102102

103103
// Make sure all computations are finished before loading the next tile:

0 commit comments

Comments
 (0)