[Mlir-commits] [mlir] 6402706 - [mlir] Fix the link of libcuda.so in MLIRGPUTransforms to not use fully qualified path (#74018)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 30 19:30:14 PST 2023
Author: Mehdi Amini
Date: 2023-11-30T19:30:05-08:00
New Revision: 6402706a00e806aef62836cd1a13a412349121eb
URL: https://github.com/llvm/llvm-project/commit/6402706a00e806aef62836cd1a13a412349121eb
DIFF: https://github.com/llvm/llvm-project/commit/6402706a00e806aef62836cd1a13a412349121eb.diff
LOG: [mlir] Fix the link of libcuda.so in MLIRGPUTransforms to not use fully qualified path (#74018)
At the moment we find libcuda.so in a path like:
/usr/local/cuda/targets/x86_64-linux/lib/stubs/libcuda.so
and directly add this to `target_link_libraries`. The problem is that
our installed MLIR package will include the full path to the library,
and a user downstream when including our cmake installed package will
inherit this full path.
We're changing this to instead
-L /usr/local/cuda/targets/x86_64-linux/lib/stubs/ -lcuda
Added:
Modified:
mlir/lib/Dialect/GPU/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/GPU/CMakeLists.txt b/mlir/lib/Dialect/GPU/CMakeLists.txt
index b76d18e81246eb1..e8b69879ad6a7ed 100644
--- a/mlir/lib/Dialect/GPU/CMakeLists.txt
+++ b/mlir/lib/Dialect/GPU/CMakeLists.txt
@@ -135,11 +135,15 @@ if(MLIR_ENABLE_CUDA_RUNNER)
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)
+ # Add link path for the cuda driver library.
find_library(CUDA_DRIVER_LIBRARY cuda HINTS ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} REQUIRED)
+ get_filename_component(CUDA_DRIVER_LIBRARY_PATH "${CUDA_DRIVER_LIBRARY}" DIRECTORY)
+ target_link_directories(MLIRGPUTransforms PRIVATE ${CUDA_DRIVER_LIBRARY_PATH})
+
target_link_libraries(MLIRGPUTransforms
PRIVATE
MLIRNVVMToLLVMIRTranslation
- ${CUDA_DRIVER_LIBRARY}
+ cuda
)
endif()
More information about the Mlir-commits
mailing list