[llvm-bugs] [Bug 33324] New: allocateMemoryForDeviceCUDA received request for 0 bytes

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 6 04:15:42 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33324

            Bug ID: 33324
           Summary: allocateMemoryForDeviceCUDA received request for 0
                    bytes
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Other
          Assignee: polly-dev at googlegroups.com
          Reporter: singapuram.sanjay at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18579
  --> https://bugs.llvm.org/attachment.cgi?id=18579&action=edit
The IR sent by Julia to Polly for the kernel_gramshmidt function.

The attached file, produced by Julia for the gramschmidt kernel in
PolyBench.jl(https://github.com/MatthiasJReisinger/PolyBench.jl/blob/master/src/linear-algebra/solvers/gramschmidt.jl),
crashes the entire program when allocateMemoryForDeviceCUDA receives a request
for 0 bytes.

This was confirmed by setting DebugMode to 1 and the following changes made to
GPUJIT.c,

 static PollyGPUDevicePtr *allocateMemoryForDeviceCUDA(long MemSize) {
-  dump_function();
+  dump_function();fprintf(stderr, "MemSize = %li\n", MemSize);

@@ -1356,7 +1358,7 @@ static PollyGPUDevicePtr
*allocateMemoryForDeviceCUDA(long MemSize) {
       CuMemAllocFcnPtr(&(((CUDADevicePtr *)DevData->DevicePtr)->Cuda),
MemSize);

   if (Res != CUDA_SUCCESS) {
-    fprintf(stderr, "Allocate memory for GPU device memory pointer
failed.\n");
+    fprintf(stderr, "%i : Allocate memory for GPU device memory pointer
failed.\n Reason: %i\n", __LINE__, Res);
     exit(-1);
   }

Which resulted in the output,
[...]
-> freeDeviceMemoryCUDA
-> polly_freeDeviceMemory
-> freeDeviceMemoryCUDA
-> polly_freeContext
-> polly_initContext
-> initContextCUDA
-> polly_allocateMemoryForDevice
-> allocateMemoryForDeviceCUDA
MemSize = 960000
-> polly_allocateMemoryForDevice
-> allocateMemoryForDeviceCUDA
MemSize = 4000
-> polly_allocateMemoryForDevice
-> allocateMemoryForDeviceCUDA
MemSize = 0
1359 : Allocate memory for GPU device memory pointer failed.
 Reason: 1

>From the output, I guessed that the entire problem is solved in smaller chunks
(will be attaching output in the next comment). In that case, how did Polly
still have chunks of data from other arrays while one array had exhausted all
its chunks ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170606/bde1e006/attachment.html>


More information about the llvm-bugs mailing list