[OpenMP] Fix nvptx CUDA_VERSION conversion
authorJoel E. Denny <jdenny.ornl@gmail.com>
Fri, 19 Feb 2021 15:59:52 +0000 (10:59 -0500)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Fri, 19 Feb 2021 16:09:26 +0000 (11:09 -0500)
commitef8b3b5ffd562955fbb78c72c7820cd9cd99d313
tree125155ab961c80c3cf9aa3a260bd42ef38a9a1fa
parentd2147b1a876187e6addd89b681d47f9f98a89669
[OpenMP] Fix nvptx CUDA_VERSION conversion

As mentioned in PR#49250, without this patch, ptxas for CUDA 9.1 fails
in the following two tests:

- openmp/libomptarget/test/mapping/lambda_mapping.cpp
- openmp/libomptarget/test/offloading/bug49021.cpp

The error looks like:

```
ptxas /tmp/lambda_mapping-081ea9.s, line 828; error   : Not a name of any known instruction: 'activemask'
```

The problem is that our cmake script converts CUDA version strings
incorrectly: 9.1 becomes 9100, but it should be 9010, as shown in
`getCudaVersion` in `clang/lib/Driver/ToolChains/Cuda.cpp`.  Thus,
`openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu`
inadvertently enables `activemask` because it apparently becomes
available in 9.2.  This patch fixes the conversion.

This patch does not fix the other two tests in PR#49250.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D97012
openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt