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?
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, then 4KiB of value and so on.
This way, when processed the various wavefront generate extremely efficient packed writes.