cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

dragonxi4amd
Journeyman III

Buffer Size Recommendations from AMD for AMD GPUs [CLOSED]

clCreateBuffer & clCreateSubBuffer

Hi,

Referring to OpenCL specs for clCreateBuffer

 

"OpenCL implementations are allowed to cache the buffer

 

contents pointed to by

 

 

host_ptr in device memory. This

cached copy can be used when kernels are executed on a

device."

 

Q1. What is the cache size used by AMD GPU

A) ATI RV770 ?

B) new 6990 ?

 

Q2. What is the minimum and maximum for region of clCreateSubBuffer function ?

Q3. Are there any limits / recommendations to number of regions in a buffer - due to cache feature for example ?

Q4. Can one release a created sub-buffer ?

 

 

 

 

 

 

 

 

 

 

 

 

0 Likes
7 Replies
himanshu_gautam
Grandmaster

"OpenCL implementations are allowed to cache the buffer

>>You need to use the flag -fno-alias for caching.

 

contents pointed to by

 

host_ptr in device memory. This

cached copy can be used when kernels are executed on a

device."

Q1. What is the cache size used by AMD GPU

A) ATI RV770 ?

B) new 6990 ?

>> L1 and L2 caches are used. Sizes are given in Appendix D of Programming guide( gen L1 - 8K and L2-128K)

Q2. What is the minimum and maximum for region of clCreateSubBuffer function ?

>> I don't think there should be any limit. you should be able to have a region value from 0 to bufferSize.

Q3. Are there any limits / recommendations to number of regions in a buffer - due to cache feature for example ?

Q4. Can one release a created sub-buffer ?

>> I think a subBuffer is just another cl_mem object.Refer to sec 5.4 of opencl spec. From Spec: "After the memobj reference count becomes zero and commands queued for execution on a command-queue(s) that use memobj have finished, the memory object is deleted. If memobj is a
buffer object, memobj cannot be deleted until all sub-buffer objects associated with memobj are deleted."

0 Likes

The subbuffer must be contained inside the parent (sub)buffer. It can be just as large as the parent or just a single element in size. When you are done using your subbuffer, you need to release it or the parent cannot release its buffer (buffer count > 0).

 

0 Likes

Thanks for your feedbacks !

Below are my further questions/propably wrong conclusions:

F1. So it's programmer's responsibility to release sub-buffer !?

F2. There is no release command for sub-buffer !? 

* like to many other OpenCL resources &  API to be needed ?

F3. Is there retain command for sub-buffer  !?

* like to many other OpenCL resources &  API to be needed ?

F4. If one just deletes sub-buffer object, how does buffer object know that !?

- you just operate with sub-buffers without buffer object knowing that !?

F5. Or is it so that only when using clEnqueReadBuffer and clEnqueueWriteBuffer programmer gets feedback if something is wrong with buffer and its sub-buffer ?

F6. OpenCL specs seem to put challenges to developers: it looks like there is no release nor retain command to be sent via command queue to buffer object or sub-buffer object !?

F7. If it's the OpenCL runtime system which releases buffer objects while

programmers still operate with sub-buffers plus we have cache envolded,

one might get problems !?

F8. Have AMD developers tested concurrent max / bad usage of buffer and sub-buffer objects & AMD guys didn't wish release and retain commands for these two object types ?

 

 

 

 

 

0 Likes

you use normal functions to release/retain sub-buffer as it is normal buffer. so use clReleaseMemObject()

0 Likes

If you are facing any difficulties while using sub-buffers, please post a test case.

0 Likes

Thanks for your answers !

Release and retain functions could have been specified more systematically to all OpenCL resources by Khronis.

OK: release and retain are available for memory objects such as sub-buffers!

0 Likes

Note that when the spec mentions "cache the buffer contents pointed to by host memory on the device" it does not mean that it is using caches on the device, but rather that the contents of the buffer may be copied into device memory for better performance.

Jeff

0 Likes