MLIR/Cuda: Add the appropriate "HINTS" on CMake find_library and mark these REQUIRED
authorMehdi Amini <joker.eph@gmail.com>
Mon, 29 May 2023 08:38:44 +0000 (01:38 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 29 May 2023 21:32:24 +0000 (14:32 -0700)
The cmake logic to find cuda paths exposes some paths to search for the cuda
library, we need to propagate this through the call for find_library.
This was already done for cuSparse but not for cuda.

Differential Revision: https://reviews.llvm.org/D151645

mlir/lib/Dialect/GPU/CMakeLists.txt
mlir/lib/ExecutionEngine/CMakeLists.txt

index 3179049..ca16333 100644 (file)
@@ -120,8 +120,7 @@ if(MLIR_ENABLE_CUDA_RUNNER)
     ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
   )
 
-  find_library(CUDA_DRIVER_LIBRARY cuda)
-
+  find_library(CUDA_DRIVER_LIBRARY cuda HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
   target_link_libraries(MLIRGPUTransforms
     PRIVATE
     MLIRNVVMToLLVMIRTranslation
index 369fd1b..e2f76fa 100644 (file)
@@ -188,10 +188,10 @@ if(LLVM_ENABLE_PIC)
     endif()
 
     # We need the libcuda.so library.
-    find_library(CUDA_RUNTIME_LIBRARY cuda)
+    find_library(CUDA_RUNTIME_LIBRARY cuda HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
 
     # We need the libcusparse.so library.
-    find_library(CUDA_CUSPARSE_LIBRARY cusparse HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
+    find_library(CUDA_CUSPARSE_LIBRARY cusparse HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
 
     add_mlir_library(mlir_cuda_runtime
       SHARED