AnsweredAssumed Answered

Fail to allocate large fine-grained SVM buffers by clSVMAlloc

Question asked by humasama on Nov 10, 2015
Latest reply on Nov 10, 2015 by humasama

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.