Whoami
Whoami

Reputation: 14408

Why Global memory allocation is successful with the size more than the limit in GPU?

I am experimenting with Vivante GPU GC2000 Series, where the clinfo produced the below result.

 CL_DEVICE_GLOBAL_MEM_SIZE:             64 MByte
 CL_DEVICE_MAX_MEM_ALLOC_SIZE:          32 MByte
 CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:       Read/Write
 CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE:       64
 CL_DEVICE_GLOBAL_MEM_CACHE_SIZE:       4096
 CL_DEVICE_LOCAL_MEM_SIZE:          1 KByte
 CL_DEVICE_LOCAL_MEM_TYPE:          Global
 CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE:        4 KByte
 CL_DEVICE_MAX_CONSTANT_ARGS:           9

From above output, it is clear that 64MByte is the limit for Global Memory allocation.

Now, when I tried allocating 900Mbytes global size, i have not received any error and it is successful.

int noOfBytes = (900 * 1024 * 1024);
memPtr = clCreateBuffer(context, CL_MEM_READ_WRITE, noOfBytes, NULL, &err);
 if ( err != CL_SUCESS) {
    printf ("Ooops.. Failed");
  }

Sounds this experiment is show proving what the clinfo claims. Am i missing any theory or something else ?

Upvotes: 3

Views: 211

Answers (1)

Dithermaster
Dithermaster

Reputation: 6333

Because buffers and images are allocated on an OpenCL context (not an OpenCL device) the actual device allocation is often deferred until the buffer is used on a specific device. So while this allocation seemed to work, if you try to actually use that buffer on your device, you'll get an error.

Upvotes: 4

Related Questions