cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rahulgarg
Adept II

OpenCL buffer size limited?

I am trying to allocate large buffers (around 200MB) but it appears that any allocation larger than about 130MB fails on the GPU with the error code CL_INVALID_BUFFER_SIZE.

Using a Radeon 5850 1GB, Phenom II X4 925, 8GB DDR3

Ubuntu 11.10 (64-bit) with Catalyst 11.12

I also tested a system with AMD A8-3500M APU and got similar failures.

Is there a limit on the buffer size?

0 Likes
1 Solution
antzrhere
Adept III

Yes. To see that limit query CL_DEVICE_MAX_MEM_ALLOC_SIZE. The minimum buffer size is 1/4 of the global memory size OR 128Mb, whichever is the greater. OpenCL spec does not impose any limit on the max buffer size, but provides the minimum size that OpenCL vendors must support. Sadly, so far they just comply to the minimum, so even Tahiti GPUs only allow 750Mb for a single buffers (out of 3Gb)

View solution in original post

0 Likes
3 Replies
antzrhere
Adept III

Yes. To see that limit query CL_DEVICE_MAX_MEM_ALLOC_SIZE. The minimum buffer size is 1/4 of the global memory size OR 128Mb, whichever is the greater. OpenCL spec does not impose any limit on the max buffer size, but provides the minimum size that OpenCL vendors must support. Sadly, so far they just comply to the minimum, so even Tahiti GPUs only allow 750Mb for a single buffers (out of 3Gb)

0 Likes

If you have a 1Gb card (pre-southern islands), then likely OpenCL is only allowing you access to half the global memory (<=512mb), in which case 1/4 of half of 1Gb is 128Mb (hence your limit). To access up to 100% of your global memory, set the environmental variable GPU_MAX_HEAP_SIZE to a value anywhere upto 100 (which is the percent of global memory accessible). The highest setting should allow you to allocate a 256Mb single buffer. Some report a small performance degradation when using >60% of total global memory, where some do not so keep thing in mind,

Thanks for all your help!

0 Likes