3 Replies Latest reply on Mar 7, 2012 3:17 PM by rahulgarg

    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?

        • Re: OpenCL buffer size limited?

          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)

            • Re: OpenCL buffer size limited?

              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,

              1 of 1 people found this helpful