cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

steveh_ol
Journeyman III

Image - Multidimensional NDRange - Advantage?

Hi,

for an algorithm working on an image pixel by pixel, is there an actual advantage if one uses a e.g. two dimensional NDRange for the global and local threads rather than a one dimensional NDRange?

For example the global thread number could be a 2 dimensional (image.width, image.height) NDRange or with image.width*image.height a one dimensional.

I pack my image data to a one dimensional array with size image.width*image.height, so i would have to do an additional computation on the GPU to get my array index from the 2 dimensional global NDRange.

Did I miss any possible advantage that comes with e.g. a 2-dimensional NDRange in my particular case?

 

Thank you in advance,

Greetings,

steve

0 Likes
3 Replies
nou
Exemplar

if you make some algorith which read couple of surrounding pixels than i recomend using images and not buffers with 2D NDrange.  then you can utilize texture cache.

0 Likes

Thanks for the answer!

Each pixel is processed independently from the others, so your hint does not apply to this particular algorithm. Thanks though, I'll keep that in mind for further work.

Are there any other possible advantages?

0 Likes

AFAIK the dimensions in NDrange are more for conceptual purpose. I am not able to recollect any performance benifit you might have using 2D buffer instead of 1D bufferr.

For images nou has given an excellent reason to use 2D images if the access pattern is supportive. Using images i think is always faster than buffers, and one disadvantage of 1D image is that its size is limited to 8k elements only.

For 2D image the image size allowed is 8k*8k.

0 Likes