【问题标题】:How can I disable the ptxas warning about indeterminable stack size?如何禁用有关不确定堆栈大小的 ptxas 警告?
【发布时间】:2020-04-18 19:32:33
【问题描述】:

在编译 CUDA 设备代码时,您可能会遇到错误(为了便于阅读而使用换行符):

ptxas warning : Stack size for entry function '_ZN7kernels11print_stuffIiEEvv' 
cannot be statically determined

这可以有several reasons, like dynamic memory allocation or use of recursion,但现在这些都不重要。我想至少在某些功能内禁用警告。问题是,我不知道要使用哪个令牌。搜索 this list(在 the suggestion here SO 之后禁用特定警告)是没有用的 - 因为这些是 NVCC 的 C/C++ 前端中的警告,而不是汇编程序。

那么如何我禁用这个警告?

【问题讨论】:

  • 显然你链接到无关紧要,那些是为了从 CUDA 前端禁用 C 或 C++ 警告。您的警告来自汇编程序......
  • @talonmies:将进行编辑以澄清这一点。
  • @talonmies:你确定吗?如果是这样,请回答。
  • here 给你的答案有什么问题?因为你想要在每个函数的基础上工作的东西,比如编译指示?或者您担心它可能会抑制“其他”堆栈大小警告(不确定那些会是什么)?还是别的什么?
  • @RobertCrovella:编辑历史在这里提供了丰富的信息。最初的问题是暗示会有一个编译指示或前端选项来抑制这个警告,这显然是不可能的。尽管如此,当有人在这个标签上问了超过 350 个问题时,我想可能很难记住他们已经问过和回答过的所有问题......

标签: cuda compiler-warnings nvcc ptxas assembler-warnings


【解决方案1】:

需要注意的重要一点是,这是一个汇编程序警告,因此通常的前端警告抑制选项都不相关。

ptxas 仅支持数量非常有限的警告控制选项。在 CUDA 9 之前,仅支持以下内容:

--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.

在您的情况下,唯一的选择是禁止所有警告。将-Xptxas='-w' 添加到任何nvcc 调用应该可以实现这一点。

CUDA 9 和更高版本添加另一个选项ptxas,它会抑制您询问的警告:

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

在这种情况下,将-Xptxas='-suppress-stack-size-warning' 添加到任何nvcc 调用应该消除警告。

【讨论】:

  • @einpoklum:我错过了 -suppress-stack-size-warning 被添加到 CUDA 9(当我运行 ptxas -h 时,我正在对 CUDA 8 进行回归测试)。所以你想要的已经存在了。但是您应该已经从几周前提出的几乎相同的问题中知道了这一点。
猜你喜欢
  • 1970-01-01
  • 2014-06-09
  • 1970-01-01
  • 2012-09-09
  • 2010-09-15
  • 2010-12-13
  • 1970-01-01
  • 2011-07-13
相关资源
最近更新 更多