Skip to content

Commit

Permalink
add optimization 5 that unrolls the 1D wavelet kernel and avoids regi…
Browse files Browse the repository at this point in the history
…ster spills.
  • Loading branch information
ooreilly committed Jan 8, 2021
1 parent cc38004 commit 608b35b
Show file tree
Hide file tree
Showing 7 changed files with 855 additions and 90 deletions.
21 changes: 21 additions & 0 deletions init_y.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Write bx * by * bz blocks each of dimension nx * ny * nz
void init_y(float*& out, int nx, int ny, int nz, int bx, int by, int bz) {

size_t block = nx * ny * nz;
out = (float*)malloc(sizeof(float) * block * bx * by * bz);

// Number of blocks
for (int jz = 0; jz < bz; ++jz)
for (int jy = 0; jy < by; ++jy)
for (int jx = 0; jx < bx; ++jx) {
// Block dimension
for (int iz = 0; iz < nz; ++iz)
for (int iy = 0; iy < ny; ++iy)
for (int ix = 0; ix < nx; ++ix) {
size_t pos_block = ix + nx * (iy + ny * iz);
size_t pos = pos_block + block * (jx + bx * (jy + by * jz));
out[pos] = iy;
}
}
}

Loading

0 comments on commit 608b35b

Please sign in to comment.