Is there a utility out there to analyze PTX variable allocation and show these in-line with the actu

Hi all,

I had an interesting idea, and before I set out doing this (in a few months, once my main project is finished), I wanted to see if it is already out there.

I want a utility that will analyze the ptx source code that is spit out by the compilation process, and go back in to the compiled .cu files and add comments to the original source code (or tell the programmer in some easy to see way) that states what type of memory the variable was allocated in.

For example:

[codebox]void kernel()

{

int var_name;

int var1[10];

shared int var_2;

.

.

.

}

[/codebox]

Gets modified to:

[codebox]void kernel()

{

int var_name; //register (x of y used)

int var1[10]; //local memory (x2 of y2 used)

shared int var_2; //shared memory (x3 of y3 used)

.

.

.

}

[/codebox]

Does anyone know if something like this exists?

Thanks,

Adam

Nope. I haven’t heard of anything like that, but it sounds like it would be a good way to do a ‘first-pass’ of tuning on your code (so that you can quickly see if you have an inefficient calculation or something).

One way of getting this kind of information would be to compile the kernel with both debug info and optimizations enabled.
Like nvcc -G, but without spilling all variables to local memory…

It should generate the machine-readable symbol table that map variables to their final memory space and address. (And line numbers, so as a side effect you’ll get the number of machine instructions corresponding to each source line.)

This might be achieved by running nvcc -G --dryrun, then editing the command lines to reenable optimizations. Never tried this myself, though.