<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - allocateMemoryForDeviceCUDA received request for 0 bytes"
   href="https://bugs.llvm.org/show_bug.cgi?id=33324">33324</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>allocateMemoryForDeviceCUDA received request for 0 bytes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Polly
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>singapuram.sanjay@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18579" name="attach_18579" title="The IR sent by Julia to Polly for the kernel_gramshmidt function.">attachment 18579</a> <a href="attachment.cgi?id=18579&action=edit" title="The IR sent by Julia to Polly for the kernel_gramshmidt function.">[details]</a></span>
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(<a href="https://github.com/MatthiasJReisinger/PolyBench.jl/blob/master/src/linear-algebra/solvers/gramschmidt.jl">https://github.com/MatthiasJReisinger/PolyBench.jl/blob/master/src/linear-algebra/solvers/gramschmidt.jl</a>),
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 ?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>