Texture Usage Stats


Not sure if this has been asked before ,but is there a way to look at the usage/stats of texture memory used in a CUDA program just like you can determine for global memory, registers, shared memory, and constant memory using -cubin or --ptxas-options=-v options with nvcc.

cuda-gdb doesnt give much insight on whats happening on the device ,and whether my program is efficiently using textures for the purpose i have placed them for.

Any pointers will be helpful.

Thank You.

PS : I am aware that textures are glorified global memory which is cached ,but not sure if could make out any meaning from the global memory usage.


As far as I know there isn’t, nor do you have counters for textures in the visual profiler - which is a real pitty.

However you can do two things:

  1. Figure out how much time of your kernel is spent on textures. Replace code like this:

   float x = tex1dfetch(....);

   float2 y = tex1deftch( ... );

to something like this (just dummy simple values):

float x = threadIdx.x;

   float2 y; y.x = blockIdx.x; y.y = threadIdx.y;

Now you can know how much % of your kernel time is done on textures.

  1. Replace texture calls with simple, direct gmem code - that will give you how much faster/slower you are when using textures

In all cases - make sure you dont remove too much code making the optimizer optimize out the entire kernel… :)

hope that helps


Tx so much Eyal…The delta definitely is a workaround to see the time texture has been using on Kernel Run.

The thing is ,I have been trying to audaciously do piecewise trilinear interpolation using textures ,where in my texture is bound to a 3D Array of 128128128,However there are some non integer indices which i want to interpolate over the 3D bound texture as opposed to using the usual texture coordinates (which are the thread indices out of Grid Block).

I am not even sure in the first place whether that’s allowed and hence was tryin to search for something like the profiler to see how texture is behaving while I attempt this.

This evokes another question whether i can use other than thread indices for 3D texture coordinates ??