0
votes

i'm trying to program with opencl.

There are two types of memory object. one is buffer and another one is image.

some blogs and web site,white papers say 'image object is little bit faster that buffer because of cache'.

i'm trying to use image object and the reason for that is 'clamp', it will make kernel code more simpler and faster(my opinion)

my question is 'is it possible to use image object and local memory and is it faster(than using buffer object with local memory)?"

Data-> image object-> copy to local memory -> operations -> write back to other image object.

As far as i understood, i cannot use async_work_group_copy instruction for local memory in this case.

so i have to copy and synchronize manually for local memory. it will make overhead a lot.

1

1 Answers

0
votes

The only real answer to that is "it depends". Most implementations don't really have a value in doing async_work_group_copy. Image reads may be slightly higher latency than buffer reads when there is a cache hit, but you may get better cache behaviour from them on some architectures. Clamping, address calculation and filtering are effectively free operations performed by dedicated hardware, that you'd have to shift into shader code when using buffers, so that reduces your read latency and may increase throughput.

If you are going to get big caching benefits from images, local memory may just get in the way. The extra cost of writing to it, synchronizing, reading from it, calculating addresses and so on may cost you.

Sadly this is just one of those things you'll have to experiment with on your target architectures.