how could I generate sass+source file dump files via cuobjdump?

Hi all,

I was trying to generate a mixed sass + source dump file via cuobjdump as described in cuobjdump --help. I used -G for nvcc and I think debugging information is avaliable ( I can use cuda-gdb to debug into it). But still I got only sass. I don’t know what does “and if the source files can still be found.” mean in the help message. Do I need to do something else to make my source code avaliable to the cuobjdump?

I am using CUDA 4.1

Thanks in advance.

Bo

I am not aware of any cuobjdump functionality that allows one to dump machine code (SASS) interspersed with source code, although that certainly would be very handy in my line of work. I don’t see this being mentioned in the output of the --help flag, neither in CUDA 4.1 nor any more recent versions (see output below). If anybody has any pointers where this cuobjdump functionality is mentioned, I can follow up (it may be a feature I am simply not aware of, or there may be a documentation bug).

C:\[...]\toolkit\r4.1\bin\[...]>.\cuobjdump --help

Usage  : cuobjdump [options] <file>

Options

=======

--dump-cubin                    (-cubin)

        Dump cubin for all listed device functions.

--dump-elf                      (-elf)

        Dump ELF Object sections.

--dump-function-names           (-fnam)

        Dump names of device functions. This option is implied if options

        --dump-sass, --dump-cubin or --dump-ptx are also given.

--dump-ptx                      (-ptx)

        Dump ptx for all listed device functions.

--dump-sass                     (-sass)

        Dump assembly for all listed device functions.

--file <filename>,...           (-f)

        Specify names of source files whose fat binary structures must be

        dumped. Source files may be specified by the full path by which they

        were compiled using nvcc, or file name only (omitting the directory

        part), of file base name only (omitting directory and the '.cu' file

        extension).

--function <function name>,...  (-fun)

        Specify names of device functions whose fat binary structures must be

        dumped.

--help  (-h)

        Print this help information on this tool.

--options-file <file>,...       (-optf)

        Include command line options from specified file.

--sort-functions                (-sort)

        Sort functions when dumping sass.

--version                       (-V)

        Print version information on this tool.

Hi,

Here is the output of cuobjdump --help on my machine. I am using Linux ( I guess you are using Windows based on your output?)

Usage : cuobjdump [options]

Options

=======

–dump-cubin (-cubin)

    Dump cubin for all listed device functions.

–dump-elf (-elf)

    Dump ELF Object sections.

–dump-function-names (-fnam)

    Dump names of device functions. This option is implied if options 

    --dump-sass, --dump-cubin or --dump-ptx are also given.

–dump-ptx (-ptx)

    Dump ptx for all listed device functions.

–dump-sass (-sass)

    Dump assembly for all listed device functions. Cuda source is 

    intermixed with the listed assembly in case option -G was specified to 

    nvcc during compilation, and if the source files can still be found.

–file ,… (-f)

    Specify names of source files whose fat binary structures must be 

    dumped. Source files may be specified by the full path by which they 

    were compiled using nvcc, or file name only (omitting the directory 

    part), of file base name only (omitting directory and the '.cu' file 

    extension).

–function ,… (-fun)

    Specify names of device functions whose fat binary structures must be 

    dumped.

–help (-h)

    Print this help information on this tool.

–options-file ,… (-optf)

    Include command line options from specified file.

–sort-functions (-sort)

    Sort functions when dumping sass.

–version (-V)

    Print version information on this tool.

Surprisingly, the discrepancy in the Windows / Linux help output is correct, and the functionality should be there on Linux as the help says. Even though I predominantly use Linux, I had never noticed this feature before! After some digging I established that this feature (interspersed source and SASS) was added a long time ago, and was restricted to Linux for technical reasons. The requirements on the source files are that they much be in exactly the same location as when the code was compiled. However, when I tried it, making sure the source code was where it needed to be, I got plain SASS disassembly without any source code, just like you. I would suggest filing a bug to get the feature fixed. There is a link to the bug reporting form on the registered developer website.

In the meantime, you might want to check whether you could achieve a “mixed” view with the CUDA debugger. I don’t know whether it supports this or not. From what I understand -G invokes a debug build, so the generated SASS may look a lot different from the SASS produced by a default (release) build with full optimizations.

Hi njuffa,

I have used cuda-gdb for a while and I am pretty sure that such mixed view exists. When I was debugging the code, I could see SASS code as well as source code together.

I can file a bug report on this issue. Thank you for your suggestion.

Bo

Did someone say enhancement requests?

I’d like a cumulative register-in-use count as well. Either in the SASS or interspersed source ptxas output.

e.g. in SASS:

Function : _Z14fooKernelPj

	/*0000*/     /*0x00005de428004404*/ 	MOV R1, c [0x1] [0x100];  /* rreg:1 preg:0 */

	/*0008*/     /*0x94001c042c000000*/ 	S2R R0, SR_CTAid_X;       /* rreg:2 preg:0 */

        ...

Something similar could be done for inlined source.

I’m guessing there are regular registers, predicate registers, etc.

This extra info could help pinpoint areas of register pressure.

External Image

Enhancement requests are also best communicated through the bug reporting form. I would suggest prefixing the synopsis with “RFE:” for “request for enhancement”.