From 0f647148e5601ef7df43dde2b06f4a72997a8108 Mon Sep 17 00:00:00 2001 From: yf711 Date: Sun, 2 Feb 2025 17:57:11 -0800 Subject: [PATCH] enable rdc and skip error --- cmake/onnxruntime_providers_cuda.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/onnxruntime_providers_cuda.cmake b/cmake/onnxruntime_providers_cuda.cmake index 4f86717026..e6c9c57281 100644 --- a/cmake/onnxruntime_providers_cuda.cmake +++ b/cmake/onnxruntime_providers_cuda.cmake @@ -158,6 +158,13 @@ set(onnxruntime_NVCC_THREADS "1" CACHE STRING "Number of threads that NVCC can use for compilation.") target_compile_options(${target} PRIVATE "$<$:SHELL:--threads \"${onnxruntime_NVCC_THREADS}\">") endif() + + # relocatable-device-code=true + if (MSVC AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) + set_target_properties(${target} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) + target_compile_options(${target} PRIVATE "$<$:--relocatable-device-code=true>") + target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler /wd4505>") + endif() if (UNIX) target_compile_options(${target} PRIVATE "$<$:SHELL:-Xcompiler -Wno-reorder>"