[libc-commits] [PATCH] D147653: [libc] Search for the CUDA patch explicitly when testing

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Apr 5 13:15:08 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f5c6dcf5952: [libc] Search for the CUDA patch explicitly when testing (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D147653?vs=511182&id=511194#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147653

Files:
  libc/cmake/modules/LLVMLibCObjectRules.cmake
  libc/cmake/modules/LLVMLibCTestRules.cmake
  libc/cmake/modules/prepare_libc_gpu_build.cmake
  libc/startup/gpu/nvptx/CMakeLists.txt
  libc/test/IntegrationTest/CMakeLists.txt


Index: libc/test/IntegrationTest/CMakeLists.txt
===================================================================
--- libc/test/IntegrationTest/CMakeLists.txt
+++ libc/test/IntegrationTest/CMakeLists.txt
@@ -8,6 +8,7 @@
   set(TEST_COMPILE_FLAGS
     -march=${LIBC_GPU_TARGET_ARCHITECTURE}
     --target=${LIBC_GPU_TARGET_TRIPLE}
+    --cuda-path=${LIBC_CUDA_ROOT}
   )
 endif()
 
Index: libc/startup/gpu/nvptx/CMakeLists.txt
===================================================================
--- libc/startup/gpu/nvptx/CMakeLists.txt
+++ libc/startup/gpu/nvptx/CMakeLists.txt
@@ -10,6 +10,7 @@
     -nogpulib # Do not include any GPU vendor libraries.
     -march=${LIBC_GPU_TARGET_ARCHITECTURE}
     --target=${LIBC_GPU_TARGET_TRIPLE}
+    --cuda-path=${LIBC_CUDA_ROOT}
   NO_GPU_BUNDLE # Compile this file directly without special GPU handling.
 )
 get_fq_target_name(crt1 fq_name)
@@ -19,4 +20,5 @@
   PUBLIC
   "-march=${LIBC_GPU_TARGET_ARCHITECTURE}"
   "--target=${LIBC_GPU_TARGET_TRIPLE}"
+  "--cuda-path=${LIBC_CUDA_ROOT}"
 )
Index: libc/cmake/modules/prepare_libc_gpu_build.cmake
===================================================================
--- libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -98,3 +98,11 @@
 else()
   message(FATAL_ERROR "Unknown GPU architecture '${gpu_test_architecture}'")
 endif()
+
+if(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
+  find_package(CUDAToolkit QUIET)
+  if(CUDAToolkit_FOUND)
+    get_filename_component(LIBC_CUDA_ROOT "${CUDAToolkit_BIN_DIR}" DIRECTORY ABSOLUTE)
+    message(WARNING ${LIBC_CUDA_ROOT})
+  endif()
+endif()
Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -507,6 +507,7 @@
                            --target=${LIBC_GPU_TARGET_TRIPLE})
   elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
     target_compile_options(${fq_build_target_name} PRIVATE
+                           --cuda-path=${LIBC_CUDA_ROOT}
                            -march=${LIBC_GPU_TARGET_ARCHITECTURE}
                            --target=${LIBC_GPU_TARGET_TRIPLE})
   endif()
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -195,7 +195,9 @@
     if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
       target_compile_options(${internal_target_name} PRIVATE -mcpu=${LIBC_GPU_TARGET_ARCHITECTURE} -flto)
     elseif(LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
-      target_compile_options(${internal_target_name} PRIVATE -march=${LIBC_GPU_TARGET_ARCHITECTURE})
+      target_compile_options(${internal_target_name} PRIVATE
+                             -march=${LIBC_GPU_TARGET_ARCHITECTURE}
+                             --cuda-path=${LIBC_CUDA_ROOT})
     endif()
     target_include_directories(${internal_target_name} PRIVATE ${include_dirs})
     if(full_deps_list)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147653.511194.patch
Type: text/x-patch
Size: 3093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230405/7624fa36/attachment-0001.bin>


More information about the libc-commits mailing list