onnxruntime: fix CUDAExecutionProvider loading error (#536479)

This commit is contained in:
Gaétan Lepage
2026-07-01 07:23:52 +00:00
committed by GitHub
2 changed files with 32 additions and 0 deletions
@@ -0,0 +1,26 @@
diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake
index 624057dd43..64de9a0860 100644
--- a/cmake/onnxruntime_providers_cuda.cmake
+++ b/cmake/onnxruntime_providers_cuda.cmake
@@ -310,7 +310,7 @@
message( WARNING "To compile with NHWC ops enabled please compile against cuDNN 9 or newer." )
endif()
endif()
- target_link_libraries(${target} PRIVATE CUDA::cublasLt CUDA::cublas CUDNN::cudnn_all cudnn_frontend CUDA::curand CUDA::cufft CUDA::cudart
+ target_link_libraries(${target} PRIVATE CUDA::cublasLt CUDA::cublas CUDNN::cudnn_all cudnn_frontend CUDA::curand CUDA::cufft CUDA::cudart CUDA::nvrtc CUDA::cuda_driver
${ABSEIL_LIBS} ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 safeint_interface)
endif()
diff --git a/cmake/onnxruntime_providers_cuda_plugin.cmake b/cmake/onnxruntime_providers_cuda_plugin.cmake
index e345c944dc..82742df359 100644
--- a/cmake/onnxruntime_providers_cuda_plugin.cmake
+++ b/cmake/onnxruntime_providers_cuda_plugin.cmake
@@ -250,6 +250,8 @@ target_link_libraries(onnxruntime_providers_cuda_plugin PRIVATE
CUDA::cublas
CUDA::cublasLt
CUDA::cufft
+ CUDA::nvrtc
+ CUDA::cuda_driver
CUDNN::cudnn_all
cudnn_frontend
Boost::mp11
+6
View File
@@ -134,6 +134,12 @@ effectiveStdenv.mkDerivation (finalAttrs: {
# https://github.com/microsoft/onnxruntime/issues/9155
# Patch adapted from https://gitlab.alpinelinux.org/alpine/aports/-/raw/462dfe0eb4b66948fe48de44545cc22bb64fdf9f/community/onnxruntime/0001-Remove-MATH_NO_EXCEPT-macro.patch
./remove-MATH_NO_EXCEPT-macro.patch
]
# Include additional target_link_libraries needed for cudnn-frontend >= 2.19
# See: https://github.com/microsoft/onnxruntime/pull/28849
# These changes are included in 548ab6e and fc7a9f0 upstream
++ lib.optionals cudaSupport [
./nvrtc-link.patch
];
postPatch = ''