Which memory is user for buffer object allocation ?

hello every one,

I’m new to the OpenCL , and my question is about the memory that is used by default for the allocation of buffer object. The 1.1 Specification is not very clear on this point.

Thanks in advance.

Buffer objects live in global memory. That means that both the host (CPU) and the device (GPU, etc) can read and write from buffer objects.

I’m not sure if that answers your question. Can you rephrase it?

Thanks for the replay!
My question is about the memory (Global, Local or Private) that is used for the buffer allocation. The spec are not very clear at this point
OpenCL 1.1 spec page 58 :

CL_MEM_ALLOC_HOST_PTR
This flag specifies that the application wants the OpenCL
implementation to allocate memory from host accessible
memory.

does this mean that other flags allocate buffer in memory that is not accessible to the host ?
In my thinking if buffers are systematically allocated in the host memory this could lead to a serious performances issue for kernel accessing it (unless global memory is cached?)

thanks!

does this mean that other flags allocate buffer in memory that is not accessible to the host ?

Yes. If you use the CL_MEM_ALLOC_HOST_PTR flag then clEnqueueMapBuffer() is guaranteed to work. If you don’t pass that flag then clEnqueueMapBuffer() can fail and return CL_MAP_FAILURE.

In my thinking if buffers are systematically allocated in the host memory this could lead to a serious performances issue for kernel accessing it (unless global memory is cached?)

Yes, you got it right :slight_smile: