I'm dealing with the "Stack size for entry function cannot be statically determined" warnings caused by arrays, and I need help.
I'm dealing with the "Stack size for entry function cannot be statically determined" warnings in my code. By CUDA ptxas warnings (Stack size for entry) and https://devtalk.nvidia.com/default/topic/524712/a-meaning-of-nvlink-warning-stack-size-for-entry-function-cannot-be-statically-determined/ The warning is caused by recursion.
However, I failed to find recursion in my code, instead, I find that the structure arrays will also cause such warning.
The problem can be shown with a simple example. (Edit: I'm able to get rid of those warnings by using union, but I still don't know why. Those code are in a same .cu file)
class ClassABC {
public:
__host__ __device__ ClassABC() { ; }
int m_iValue;
};
class ClassDEF {
public:
__host__ __device__ ClassDEF() { ; }
//Witout warning
//union
//{
// ClassABC m_abc[1];
// int m_values[1];
//};
//With warning
ClassABC m_abc[1];
};
__global__ void TestFunc()
{
ClassDEF def[1];
}
int main()
{
TestFunc << <1, 1 >> > ();
return 0;
}
It has the warning:
CUDALINK : nvlink warning : Stack size for entry function '_Z8TestFuncv' cannot be statically determined (target: sm_(35-75))
So, my question is, why the arrays can cause the warning, is it because I did something wrong? If I need to use arrays, can I get rid of the warning? Are they harmful?
I'm using CUDA 10.0.130 on Windows 10, and Visual Studio 2017. The warning show up from sm_35 to sm_75.
I need help, thank you!