einpoklum
einpoklum

Reputation: 131666

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

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

Upvotes: 1

Views: 383

Answers (1)

talonmies
talonmies

Reputation: 72348

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.

Upvotes: 3

Related Questions