<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 - Cuda sample code executable built by Clang 4.0.0/4.0.1 x86_64-pc-windows-msvc crashes"
   href="https://bugs.llvm.org/show_bug.cgi?id=34384">34384</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Cuda sample code executable built by Clang 4.0.0/4.0.1 x86_64-pc-windows-msvc crashes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>CUDA
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dhirajnitk@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=19061" name="attach_19061" title="cui  fronend files">attachment 19061</a> <a href="attachment.cgi?id=19061&action=edit" title="cui  fronend files">[details]</a></span>
cui  fronend files

As per LLVM Docs CUDA compilation is supported on Linux, on MacOS as of
2016-11-18, and on Windows as of 2017-01-05

So the LLVM cuda support on windows is available since Clang 3.9 but I tried to
call a basic cuda kernel program and it crashes. I used the official released
clang version 4.0.1 x86_64-pc-windows-msvc & Clang 4.0.1 built on my machine
but the executable failed in both the cases.


#include <cuda_runtime.h>
#include <device_launch_parameters.h>
__global__ 
void foo(){
    printf("Hello Inside Foo\n");
}

int main(){
    foo<<<1,1>>>();
    cudaDeviceSynchronize();
    return(0);
}


clang++ HelloCuda.cu -o HelloCuda.exe --cuda-gpu-arch=sm_30 -L"C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64" -lcudart_static -pthread</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>