c++filt not aggressive enough for some of the mangled names in PTX files

大兔子大兔子 提交于 2019-12-11 04:14:42

问题


I'm filtering my compiled PTX through c++filt, but it only demangles some of the names/labels and leaves some as-is. For example, this:

func  (.param .b32 func_retval0) _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii(
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_0,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_1,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_2
)

is demangled as this:

.func  (.param .b32 func_retval0) _INTERNAL_19_gather_bits_cpp1_ii_56538e7c::__shfl(int, int, int)(
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_0,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_1,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c6__shflEiii_param_2
)

rather than at least this:

.func  (.param .b32 func_retval0) _INTERNAL_19_gather_bits_cpp1_ii_56538e7c::__shfl(int, int, int)(
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c::__shfl(int, int, int)_param_0,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c::__shfl(int, int, int)_param_1,
        .param .b32 _ZN41_INTERNAL_19_gather_bits_cpp1_ii_56538e7c::__shfl(int, int, int)_param_2
)

I realize c++filt does not have explicit support for CUDA PTX; but note that the undemangled names differ from the demangled ones in the example merely by an addition _param_0, _param_1 etc. suffix (there's also the question of how the prefix of those names should be demangled, but let's forget about that).

  • Is there something I can do force c++filt to also apply to the parameter names/labels as well? And more generally, to all of the mangled C++ names in the PTX file?
  • Is it possible/easy to augment c++filt with awareness of the the CUDA "format", in additional to the "formats" it has already ([-s|--format {none,auto,gnu,lucid,arm,hp,edg,gnu-v3,java,gnat,dlang}])?
  • If c++filt can't be used or adapted for use in this case, how should I go about doing the demangling?

回答1:


Quoting from the documentation

The C++ implementation for device functions follows the Itanium C++ ABI.

c++filt implements demangling of Itanium C++ ABI symbols, therefore, it can demangle kernel names and device function names from PTX source or ELF objects.

However, the other symbols you have posted are CUDA ABI symbols. c++filt doesn't support those because it doesn't support the CUDA ABI. Whether they might look similar or not is irrelevant. If you really need this, then petition NVIDIA to add a demangler for CUDA ABI symbols to the toolchain, as they have done with ELF utilities and other internals.



来源:https://stackoverflow.com/questions/39249151/cfilt-not-aggressive-enough-for-some-of-the-mangled-names-in-ptx-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!