[Openmp-commits] [PATCH] D97012: [OpenMP] Fix nvptx CUDA_VERSION conversion

Joel E. Denny via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 19 05:57:36 PST 2021


jdenny updated this revision to Diff 324961.
jdenny added a comment.

Address @tianshilei1992's review.

Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97012/new/

https://reviews.llvm.org/D97012

Files:
  openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt


Index: openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
+++ openmp/libomptarget/deviceRTLs/nvptx/CMakeLists.txt
@@ -172,7 +172,15 @@
     list(GET ptx_feature_list ${itr} ptx_num)
     set(cuda_flags ${sm_flags})
     list(APPEND cuda_flags -Xclang -target-feature -Xclang +ptx${ptx_num})
-    list(APPEND cuda_flags "-DCUDA_VERSION=${cuda_version}00")
+    if("${cuda_version}" MATCHES "^([0-9]+)([0-9])$")
+      set(cuda_version_major ${CMAKE_MATCH_1})
+      set(cuda_version_minor ${CMAKE_MATCH_2})
+    else()
+      libomptarget_error_say(
+        "Unrecognized CUDA version format: ${cuda_version}")
+    endif()
+    list(APPEND cuda_flags
+      "-DCUDA_VERSION=${cuda_version_major}0${cuda_version_minor}0")
 
     set(bc_files "")
     foreach(src ${cuda_src_files})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97012.324961.patch
Type: text/x-patch
Size: 907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210219/fe2820a5/attachment.bin>


More information about the Openmp-commits mailing list