<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 - backend(OpenMP target NVPTX): Cannot select: 0x6c60f50: i16,ch = AtomicCmpSwap"
   href="https://bugs.llvm.org/show_bug.cgi?id=44219">44219</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>backend(OpenMP target NVPTX): Cannot select: 0x6c60f50: i16,ch = AtomicCmpSwap
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.0
          </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>OpenMP
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>gcc.j.kelling@hzdr.de
          </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=22889" name="attach_22889" title="Temporary files from clang++ (host: preprocessed source .ii, assembly .s; nvptx: preprocessed source .ii))">attachment 22889</a> <a href="attachment.cgi?id=22889&action=edit" title="Temporary files from clang++ (host: preprocessed source .ii, assembly .s; nvptx: preprocessed source .ii))">[details]</a></span>
Temporary files from clang++ (host: preprocessed source .ii, assembly .s;
nvptx: preprocessed source .ii))

Internal error trying to compile C++11 code with OpenMP target-offload for
NVPTX backend, employing #omp atomic directives

Command-line:
clang++  -DALPAKA_ACC_CPU_BT_OMP4_ENABLED -DALPAKA_DEBUG=0 -DBOOST_ALL_NO_LIB
-DCATCH_CONFIG_FAST_COMPILE
-I/home/yn622878/checkout/alpaka/test/common/include
-I/home/yn622878/checkout/alpaka/include -isystem
/home/yn622878/checkout/spack/opt/spack/linux-centos7-broadwell/gcc-9.2.0/boost-1.70.0-dkeb472u6a3pgudl5j4fqw7huosyngp4/include
-isystem /home/yn622878/checkout/alpaka/test/../thirdParty/catch2/include 
-fopenmp -fopenmp-targets=nvptx64-nvidia-cuda  -O2 -ftemplate-backtrace-limit=0
 --save-temps   -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic
-Wno-disabled-macro-expansion -Wno-global-constructors -Wno-padded
-Wno-extra-semi-stmt -fopenmp=libomp -std=gnu++11 -o
CMakeFiles/atomic.dir/src/AtomicTest.cpp.o -c
/home/yn622878/checkout/alpaka/test/unit/atomic/src/AtomicTest.cpp

Relevant openmp flags are:
-fopenmp -fopenmp-targets=nvptx64-nvidia-cuda

The code compiles without error when these are replaced by
-fopenmp -fopenmp=libomp -fopenmp-targets=x86_64-pc-linux-gnu
(offloading to x86 host).

Error message form clang:
fatal error: error in backend: Cannot select: 0x6c60f50: i16,ch =
AtomicCmpSwap<(load store monotonic monotonic 1 on %ir.135)> 0x6314438,
0x6c60ba8, 0x70cd828, 0x6c60ad8
  0x6c60ba8: i64,ch = CopyFromReg 0x6314438, Register:i64 %36
    0x70cdea8: i64 = Register %36
  0x70cd828: i16,ch = CopyFromReg 0x6314438, Register:i16 %54
    0x6a23440: i16 = Register %54
  0x6c60ad8: i16 = add 0x70cd828, 0x768ec50
    0x70cd828: i16,ch = CopyFromReg 0x6314438, Register:i16 %54
      0x6a23440: i16 = Register %54
    0x768ec50: i16,ch = CopyFromReg 0x6314438, Register:i16 %52
      0x711ec68: i16 = Register %52
In function:
_Z13testAtomicAddIN6alpaka3acc10AccCpuOmp4INSt3__117integral_constantImLm1EEEmEEhEvRKT_PbT0_
clang-9: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 9.0.0 (tags/RELEASE_900/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /rwthfs/rz/SW/UTIL/clang/9.0.0/bin
clang-9: note: diagnostic msg: 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.
clang-9: note: diagnostic msg: Error generating preprocessed source(s)</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>