Skip to content

Commit 2a878a6

Browse files
authored
Problem: on Blackwell GPUs, functions such as cudnnFindConvolutionBackwardDataAlgorithm may run out of stack space on Windows (leading to a stack overflow error) (#3130)
Solution: increase the stack size from the default 1 MB to 16 MB (yea, 8 MB wasn't enough, at least on my machine...)
1 parent 07c1e73 commit 2a878a6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

examples/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ macro(add_example name)
112112
# required though.
113113
target_link_options(${name} PRIVATE $<$<CONFIG:RELEASE>:-s>)
114114
endif()
115+
116+
if (MSVC)
117+
# For DNN builds on Visual C++, increase the stack size from the default 1 MB -
118+
# because otherwise there may easily be a stack overflow error (0xC00000FD) when
119+
# calling cudnnFindConvolutionBackwardDataAlgorithm (and/or friends) on Blackwell
120+
# (where calling these "Find" functions may result in a deep recursive search).
121+
if (${name} MATCHES "dnn_.*_ex")
122+
set_target_properties(${name} PROPERTIES LINK_FLAGS "/STACK:16777216")
123+
endif()
124+
endif()
115125
endmacro()
116126

117127
# if an example requires GUI, call this macro to check DLIB_NO_GUI_SUPPORT to include or exclude

0 commit comments

Comments
 (0)