<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 - Trying to compile an OpenCL through LLVM IR triggers "Cannot cast between two non-generic address spaces""
   href="https://bugs.llvm.org/show_bug.cgi?id=47610">47610</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Trying to compile an OpenCL through LLVM IR triggers "Cannot cast between two non-generic address spaces"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>Backend: PTX
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>emmanuel.attia@philips.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi all,

* I try to compile this simple test.cl file:
--------
kernel void toto(global float * output, local int * param)
{
    output[*param] = 0;
}
-------
Note: "local" can be replaced by constant

* Using these command line:

clang -emit-llvm -S -target nvptx test.cl -o test.ll
llvm-link test.ll -o test.bc
clang -target nvptx test.bc -S -o test.ptx

(Obviously later to link with libclc .bc files)

* I have this error:

fatal error: error in backend: Cannot cast between two non-generic address
spaces
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -target nvptx test.bc -S -o test.ptx
1.      Code generation
2.      Running pass 'Function Pass Manager' on module 'test.bc'.
3.      Running pass 'NVPTX DAG->DAG Pattern Instruction Selection' on function
'@toto'


* Tested with:

clang-9 from Ubuntu 18.04
clang-10.0.1 build from llvm-project git
clang-11-rc2 build from llvm-project git
clang-12-sycl build from intel's llvm git

Note that:
clang -S -target nvptx test.cl -o test.ptx
works perfectly (but doesn't allow to link with nvptx--nvidiacl.bc from libclc)

Am I doing something wrong ?</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>