Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

2D Laplacian memory tiling

Hello everyone,

I have a bit of a doubt and I hope someone can help me here. I've seen several examples for the 5-point stencil of the 2D laplacian, but usually in global memory (which I've already implemented with the periodic boundary conditions I require). I'm currently trying to obtain an implementation which utilizes memory tilling, except I simply don't know how to deal with the ghost rows and columns. If anyone has an example I can use I would be most grateful.



1 Reply
Adept III

Re: 2D Laplacian memory tiling

Its could be something like:

    - load each threads own cell from global memory to local memory using all threads in the workgroup.

    - load security paddings from global memory to local memory using the surface threads(2D thread group-->4x 1D edges) so it doesnt go out of bounds when using stencil on interior-edges

    - synchronize threads on local memory using barrier

    - do whatever your kernel does but use local memory this time instead of global memory.

what you need here is:

  - each thread's local thread id

  - predefined local array

  - barrier (on local memory)

  - some access pattern that doesn't conflict on local memory banks much

a simple additional offset to access local memory should be used to overcome paddings.