Skip to content

Commit bbe7c87

Browse files
authored
Fix 1.20 cuda minimal build failure (microsoft#22751)
### Description Fixes build failure for the cuda minimal build ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> [This change](microsoft#19470) in 1.20 is causing build failures for the cuda minimal build. Essentially, some cudnn logic was not guarded by the `USE_CUDA_MINIMAL`. Also the build is looking for cudnn while in the cuda minimal build it shouldn't depend on it, resulting in linking error. cc @gedoensmax @chilo-ms
1 parent ac9c135 commit bbe7c87

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cmake/onnxruntime_unittests.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ function(AddTest)
6767
if(onnxruntime_USE_CUDA)
6868
#XXX: we should not need to do this. onnxruntime_test_all.exe should not have direct dependency on CUDA DLLs,
6969
# otherwise it will impact when CUDA DLLs can be unloaded.
70-
target_link_libraries(${_UT_TARGET} PRIVATE CUDA::cudart cudnn_frontend)
70+
target_link_libraries(${_UT_TARGET} PRIVATE CUDA::cudart)
71+
if(NOT onnxruntime_CUDA_MINIMAL)
72+
target_link_libraries(${_UT_TARGET} PRIVATE cudnn_frontend)
73+
endif()
7174
endif()
7275
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock ${onnxruntime_EXTERNAL_LIBRARIES})
7376
endif()

onnxruntime/core/providers/cuda/cudnn_fe_call.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "core/providers/cuda/shared_inc/cudnn_fe_call.h"
55
#include "core/providers/shared_library/provider_api.h"
66
#include <core/platform/env.h>
7-
#if !defined(__CUDACC__)
7+
#if !defined(__CUDACC__) && !defined(USE_CUDA_MINIMAL)
88
#include <cudnn_frontend.h>
99
#endif
1010
#ifdef _WIN32
@@ -22,7 +22,7 @@ const char* CudaErrString(ERRTYPE) {
2222
ORT_NOT_IMPLEMENTED();
2323
}
2424

25-
#if !defined(__CUDACC__)
25+
#if !defined(__CUDACC__) && !defined(USE_CUDA_MINIMAL)
2626
#define CASE_ENUM_TO_STR_CUDNN_FE(x) \
2727
case cudnn_frontend::error_code_t::x: \
2828
return #x

onnxruntime/core/providers/cuda/shared_inc/cudnn_fe_call.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "core/common/common.h"
66
#include "core/providers/cuda/cuda_pch.h"
77
#include "core/providers/cuda/shared_inc/cuda_call.h"
8-
#if !defined(__CUDACC__)
8+
#if !defined(__CUDACC__) && !defined(USE_CUDA_MINIMAL)
99
#include <cudnn_frontend.h>
1010
#endif
1111
namespace onnxruntime {
@@ -14,10 +14,12 @@ namespace onnxruntime {
1414
// Error handling
1515
// -----------------------------------------------------------------------
1616

17+
#ifndef USE_CUDA_MINIMAL
1718
#define CUDNN_FE_CALL(expr) (CudaCall<cudnn_frontend::error_t, false, \
1819
cudnn_frontend::error_code_t>((cudnn_frontend::error_t)(expr), #expr, "CUDNN_FE", \
1920
cudnn_frontend::error_code_t::OK, "", __FILE__, __LINE__))
2021
#define CUDNN_FE_CALL_THROW(expr) (CudaCall<cudnn_frontend::error_t, true, \
2122
cudnn_frontend::error_code_t>((cudnn_frontend::error_t)(expr), #expr, "CUDNN_FE", \
2223
cudnn_frontend::error_code_t::OK, "", __FILE__, __LINE__))
24+
#endif
2325
} // namespace onnxruntime

0 commit comments

Comments
 (0)