In all details, this is a rather broad topic. But in general, you can use the same memory types (and in the same way) as in plain OpenCL. The most important destinction is beween “global” and “local”, I guess (“private” is just the default, and “constant” is something I’ve rarely seen until now - though it certainly has its application cases).
I just looked over the Samples again, and was a bit surprised that there indeed is only one “simple” sample that uses local memory, namely
with this kernel:
As you can see, the
__local memory is just declared as a kernel parameter, and it is “allocated” by passing
null as a kernel argument, but with a certain size - e.g.
clSetKernelArg(kernel, argumentIndex, sizeOfLocalMemory, null);
I should probably add samples for other memory types as well. (E.g. I think there currently is no sample of using constant memory).