cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

boxerab
Challenger

Fastest way of copying data from private array to global buffer ?

I have a private array of type uchar, and I would like to copy 1024 bytes into a global buffer of type uchar.

What is the best way of doing this?

0 Likes
1 Solution
maxdz8
Elite

In my experience the most effective way (but usually not very convenient) is to pack the same index of the array in subsequent memory addresses while striding subsequent indices by the global work size.

So, if you have 4096 work items, each to copy out 1024 bytes, you get 4KiB of value[0], then 4KiB of value[1] and so on.

This way, when processed the various wavefront generate extremely efficient packed writes.

View solution in original post

0 Likes
1 Reply
maxdz8
Elite

In my experience the most effective way (but usually not very convenient) is to pack the same index of the array in subsequent memory addresses while striding subsequent indices by the global work size.

So, if you have 4096 work items, each to copy out 1024 bytes, you get 4KiB of value[0], then 4KiB of value[1] and so on.

This way, when processed the various wavefront generate extremely efficient packed writes.

0 Likes