[Mlir-commits] [mlir] b936816 - MLIR/Cuda: Add the appropriate "HINTS" on CMake find_library and mark these REQUIRED

Mehdi Amini llvmlistbot at llvm.org
Mon May 29 14:32:37 PDT 2023


Author: Mehdi Amini
Date: 2023-05-29T14:32:24-07:00
New Revision: b936816fb305cc16d2d1cd6d424c08c39a681a32

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

LOG: MLIR/Cuda: Add the appropriate "HINTS" on CMake find_library and mark these REQUIRED

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index 31790490828f1..ca163338f4237 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -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

diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 369fd1b8ca77f..e2f76fa51ba93 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -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


        


More information about the Mlir-commits mailing list