[libc-commits] [libc] 2421483 - [libc] Fix `nvptx_options` variable not being reset in CMake

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Apr 19 13:28:42 PDT 2023


Author: Joseph Huber
Date: 2023-04-19T15:28:26-05:00
New Revision: 24214832fd433a901c2296088bf23b7bc86c6a96

URL: https://github.com/llvm/llvm-project/commit/24214832fd433a901c2296088bf23b7bc86c6a96
DIFF: https://github.com/llvm/llvm-project/commit/24214832fd433a901c2296088bf23b7bc86c6a96.diff

LOG: [libc] Fix `nvptx_options` variable not being reset in CMake

Summary:
This variable was not being reset, which caused the options to be
compounded when building multiple architectures. This was very
problematic as the architectures are not compatible.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 5a9fdc643f44a..b62a799c7026c 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -66,11 +66,12 @@ endfunction()
 
 # Obtains NVPTX specific arguments for compilation.
 # The PTX feature is primarily based on the CUDA toolchain version. We want to
-# be able to target NVPTX without an existing architecture, 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.
+# 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.
 # 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")


        


More information about the libc-commits mailing list