How can I disable the ptxas warning about indeterminable stack size?

807 Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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:

--suppress-double-demote-warning                    (-suppress-double-demote-warning)
        Suppress the warning that is otherwise emitted when a double precision instruction
        is encountered in PTX that is targeted for an SM version that does not have
        double precision support

--disable-warnings                                  (-w)                        
        Inhibit all warning messages.

--warn-on-double-precision-use                      (-warn-double-usage)        
        Warning if double(s) are used in an instruction.

--warn-on-local-memory-usage                        (-warn-lmem-usage)          
        Warning if local memory is used.

--warn-on-spills                                    (-warn-spills)              
        Warning if registers are spilled to local memory.

--warning-as-error                                  (-Werror)                   
        Make all warnings into errors.

In your case the only option would be to suppress all warnings. Adding -Xptxas='-w' to any nvcc invocation should achieve that.

CUDA 9 and newer add another option ptxas which suppresses the warning you ask about:

--suppress-stack-size-warning                       (-suppress-stack-size-warning)
        Suppress the warning that otherwise is printed when stack size cannot be
        determined.

In this case, adding -Xptxas='-suppress-stack-size-warning' to any nvcc invocation should eliminate the warning.