[libc-commits] [libc] 8704c3a - [libc] Set minimum CUDA PTX feature to +ptx60

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Thu Apr 20 16:01:20 PDT 2023


Author: Joseph Huber
Date: 2023-04-20T18:01:01-05:00
New Revision: 8704c3a31f6011ba43fc60bef7b3c9774b9e38d9

URL: https://github.com/llvm/llvm-project/commit/8704c3a31f6011ba43fc60bef7b3c9774b9e38d9
DIFF: https://github.com/llvm/llvm-project/commit/8704c3a31f6011ba43fc60bef7b3c9774b9e38d9.diff

LOG: [libc] Set minimum CUDA PTX feature to +ptx60

Summary:
The `+ptx` features correspond to the related CUDA version. We require a
certain set of features from the `ptxas` assembler, which is tied to the
CUDA version. Some of the ones set here were insufficient, so I am
simply setting a cutoff to the CUDA 9.0 release as the minimum. This
roughly corresponds to what should be required for sm_60 to be compiled
with the source.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index b62a799c7026c..fc4cae69c9ada 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -68,27 +68,28 @@ endfunction()
 # The PTX feature is primarily based on the CUDA toolchain version. We want to
 # be able to target NVPTX without an existing CUDA installation, so we need to
 # set this manually. This simply sets the PTX feature to the minimum required
-# for the features we wish to use on that target.
+# for the features we wish to use on that target. The minimum PTX features used
+# here roughly corresponds to the CUDA 9.0 release.
 # Adjust as needed for desired PTX features.
 function(get_nvptx_compile_options output_var gpu_arch)
   set(nvptx_options "")
   list(APPEND nvptx_options "-march=${gpu_arch}")
   if(${gpu_arch} STREQUAL "sm_35")
-    list(APPEND nvptx_options "--cuda-feature=+ptx42")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_37")
-    list(APPEND nvptx_options "--cuda-feature=+ptx43")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_50")
-    list(APPEND nvptx_options "--cuda-feature=+ptx43")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_52")
-    list(APPEND nvptx_options "--cuda-feature=+ptx43")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_53")
-    list(APPEND nvptx_options "--cuda-feature=+ptx43")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_60")
-    list(APPEND nvptx_options "--cuda-feature=+ptx50")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_61")
-    list(APPEND nvptx_options "--cuda-feature=+ptx50")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_62")
-    list(APPEND nvptx_options "--cuda-feature=+ptx50")
+    list(APPEND nvptx_options "--cuda-feature=+ptx60")
   elseif(${gpu_arch} STREQUAL "sm_70")
     list(APPEND nvptx_options "--cuda-feature=+ptx63")
   elseif(${gpu_arch} STREQUAL "sm_72")


        


More information about the libc-commits mailing list