Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Journeyman III

Clarification regarding OpenCL image buffers


I was reading the OpenCL specification to understand the mechanisms behind image buffers and the dis/advantages compared to standard buffers.

In the specification of clCreateImage I fond the following assertion:

values cannot be specified in flags but are inherited from the corresponding memory access qualifiers associated with buffer

Anyway in the function signature I can't find no arg called buffer. What does the assertion refer to with "buffer"?

I also tried to understand the advantages of images using various host/device access modes, but all the references I found talk about read-only and write-only images, while the OpenCL specification seems not to require an image to be read or write only.

Can you give me some hints regarding state-of-the-art kernel and host access performances (e.g. caching) in the various read-only, write-only and read-write situations?

Thank you very much!

2 Replies
Adept II

Hi Cadorino,

     Did you create a 1D image? if so, you can't specified the CL_MEM_USE_HOST_PTR, CL_MEM_COPY_HOST_PTR or CL_MEM_ALLOC_HOST_PTR.


It looks like buffer is in the image descriptor.  See section the spec.

Images are either read/write only in the kernel - it enables more efficient memory access as there's no need for coherent cache/snooping across many devices.

The host flags are separate and they're really just a hint to the driver as to how you expect to use the data, it's implementation specific as to whether it really makes any difference (it could optimise memory transfers/avoid cache invalidation in the various cases).   It would be up to the vendor documentation to list any specifics.