cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

abrok
Journeyman III

Kaveri - global mem size

Hi,

I use openCL on A10-7850k Kaveri GPU in 64 bit address mode. When I query global mem size like this:


cl_ulong globalSize;


clGetDeviceInfo(m_deviceId, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof (globalSize), &globalSize, 0);


then it shows 512 MB global memory. But in reality I can use much more memory, at least with CL_MEM_USE_HOST_PTR.

Am I misinterpreting something?

Roman

0 Likes
4 Replies
Ziple
Adept I

The global memory is the memory dedicated to your GPU. For a discrete desktop GPU card, it is the memory soldered on the card for example (VRAM). So it's normal: your APU doesn't have access to all your RAM because of the OS.

There is also the fact that not all the global memory is accessible to opencl but only a fraction (because if it is a display GPU, it is necessary to have some memory for desktop rendering and such). You can change the fraction used with an environmnent variable (I don't remenber wich one however).

0 Likes

I am not sure if I understand your answer. You basically say if CL_DEVICE_GLOBAL_MEM_SIZE shows 512MB, my GPU has only access to 512MB? That was also my understaning of this value. Because I didnt like that, I tested if I can access at least 6 GB of my installed 16 GB and it worked correctly.

My kernel is:


_kernel void increment(__global int* buf)


{


    const size_t index = get_global_id(0);


    ++buf[index];


}


My host buffer allocation looks like this:


const size_t size = 1500 * 1024 * 1024;


int *buf = new int[size];


srand(0);


for (size_t i = 0; i < size; ++i)


  buf = rand();


I call clCreateBuffer with the flag CL_MEM_USE_HOST_PTR:


clCreateBuffer(context, CL_MEM_USE_HOST_PTR | CL_MEM_READ_WRITE, sizeof(buf[0])*size, buffer, &error);


So it seems I can access (almost) the complete RAM with OpenCL, which is good. But I am still confused:

Is the global memory size limit meaningless when used with CL_MEM_USE_HOST_PTR?

0 Likes

I think that your results are normal. Kaveri has support for virtual memory, so even though the GPU doesn't have 6GB but 512MB, it is able to make like it has 6GB: every time it accesses some memory not in its VRAM, it causes a reload from the main memory.

You should think of the global memory like a memory dedicated to the GPU (even though, for APUs it is part of the normal RAM), and each time you ask for something out of the global memory, a reload from the normal RAM will occur.

0 Likes

It is not meaningless, it's exactly what's written.

CL_DEVICE_GLOBAL_MEM_SIZE: size of the global memory available to the CL device.

GLOBAL memory is not "system global" it's "offchip" device memory.

My Athlon X3 450 device has 2GiB global memory, even though I have 8 GiBs currently available.


The global memory size limit is not meaningless when used with CL_MEM_USE_HOST_PTR; it's just that when using host memory ... you're not using device memory (in theory). It would be correct to say it's irrelevant but not "meaningless". It's not applicable. Host memory is a thing and device memory another.

0 Likes