I'm testing some OpenCL image processing on an AMD HD 7970 (Sapphire GHz edition). This particular card has 6GB of RAM onboard, however this call:
uint64_t memSize = 0;
clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(memSize), &memSize, NULL);
always returns a value of 2,147,483,648.
I've tried this on the Catalyst drivers 13.1, 13.3 Beta, 13.4, and 13.5 Beta. All returned 2,147,483,648.
Is there an issue with this OpenCL call for returning the actual memory size of a card? Is there some sort of setting for this card that limits the amount of OpenCL memory that can be used?
Any insight would be helpful!
I would like to re-post this question, as I don't think the two links provide an answer and I experience the same problem when querying the total amount of RAM using a R9 280X card with 3 GB of RAM. The first link states that with 32 bits you can only address up to 4 GB of RAM. This is true, but 3 GB should be fine, right? The second link is about actually using all of the GPUs RAM.
But the point ist not about whether or not I can use the whole 3 GB of RAM (my tests show that I can, respecting CL_DEVICE_MAX_MEM_ALLOC_SIZE, of course). But since the driver returns an incorrect value for CL_DEVICE_GLOBAL_MEM_SIZE, my application cannot rely on this value for memory management, i.e. knowing in advance whether or not all the data needed for my calculations will fit or if I have to break up the calculations into multiple steps.
I observed the same problem using a HD 7950 with 3 GB and, very recently, a R9 290X with 4 GB. For all cards the call mentioned by glimberg returns 2 GB of RAM.
Is this just a very simple bug or is there something more to it? Thanks a lot!
Yes. This does indeed change the amount of RAM to the correct value of 3 GB, but why is this necessary? As pointed out above, 32 bits should be enough for up to 4 GB. And why do you have to search through forums to find this?
As a comparison: I recently got my hands on a GTX 780 Ti which also has 3 GB of RAM. With this card I get the correct amount of RAM without setting undocumented environment variables. Rather surprising if you consider NVIDIAs barely existing OpenCL support.
So, two questions for AMD: why do I have to set this environment variable? And why is this not documented? The really interesting cards 280X and above all have more than 2 GB of RAM and we would love to use them!