cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

humasama
Adept I

Fail to allocate large fine-grained SVM buffers by clSVMAlloc

Hi Everyone,

I try to allocate 4000MB SVM buffer space on Kaveri APU (Ubuntu 15.04 (64-bit) +16GB physical memory + Omega driver + SDK3.0). The test-case is as follows:

         char *head, *ptr;

        unsigned int size = 160;

        unsigned int perslab = 262144;

        unsigned int len = size * perslab;     //40MB

        int i;

        for (i = 0; i < 100; i ++) {

                head = (char *)clSVMAlloc(context, CL_MEM_SVM_FINE_GRAIN_BUFFER, len, 0);     //line 7

                ptr = head;

                printf("i = %d, len = %d, total = %u\n", i, len, (i+1)*len);

                *(int *)ptr = 1;     //line 10

              }

When i is 76 (allocates 3080MB space), segment fault occurs at line 10. Then I debug the above test-case and print "ptr" when segment fault happens. The gdb reports that "<error: Cannot access memory at address 0xee011a0000>".

According to the OpenCL specification version 2.0, SVM buffer size could be as large as virtual memory space size. However, clSVMAlloc returns illegal memory address after allocating 3080MB space. Does it mean that there are limits on size of SVM buffer in reality?

Any help will be greatly appreciated.

Thanks.

0 Likes
2 Replies
dipak
Big Boss

Yes. As per clSVMAlloc , the memory allocation fails if size is greater than CL_DEVICE_MAX_MEM_ALLOC_SIZE value for any device in context.

So, please check the "Max. memory allocation" parameter from clinfo.

Regards,

0 Likes

Thanks for your answer, but I still have some questions.

The output information of clinfo for CL_DEVICE_TYP_GPU is: Max memory allocation: 490733568, Global memory size: 1962934272.

Does 490733568 mean the max size of per SVM buffer object? And does 1962934272 mean that the upper limit of memory size that the GPU can use?

The total memory installed in my computer is 16GB. Why the global memory size is less than 2GB?

I have read a technical paper "Heterogeneous Architecture System: A Technical Review" by George Kyriazis (AMD). It says that TCU (e.g. GPU) support page faulting, which means that the GPU can use as large address space as the CPU.

If there are limits on the size of memory space which is available to the GPU on Kaveri APU, does it mean that the Kaveri APU doesn't have the page faulting feature currently?

I still don't quite understand why merely 2GB memory can be allocated. Is this issue caused by current OpenCL driver or APU hardware?

Regards,

0 Likes