When compiling CUDA device code, you may get the error (with line break for readability):
ptxas warning : Stack size for entry function '_ZN7kernels11print_stuffIiEEvv'
cannot be statically determined
This can have several reasons, like dynamic memory allocation or use of recursion, but those don't matter right now. I want to disable the warning, within some function at least. The thing is, I don't know which token to use to do so. It's no use searching this list (following the suggestion here SO about disabling specific warnings) - because those are warnings in the C/C++ front-end of NVCC, not the assembler.
So how can I disable this warning?
The important point to note is that this is an assembler warning, so none of the usual front end warning suppression options are relevant.
ptxas
only supports a very limited number of warning control options. Prior to CUDA 9, only the following were supported:In your case the only option would be to suppress all warnings. Adding
-Xptxas='-w'
to anynvcc
invocation should achieve that.CUDA 9 and newer add another option
ptxas
which suppresses the warning you ask about:In this case, adding
-Xptxas='-suppress-stack-size-warning'
to anynvcc
invocation should eliminate the warning.