tex1DFetch - how many bits to fetch ? Is is better to fetch 32,64 or 128 bits?

Hi All,

Main input data for my kernel is a simple int* array that a bind to the texture. The I use tex1dfetch to access the data.

Will it be beneficial to implement the texture reference not as a texture of ints:
texture<int, 1, cudaReadModeElementType> texInput;

but as a texture of, say, long ints:
texture<long int, 1, cudaReadModeElementType> texInput;

so reducing the number of memory accesses in two times (with consequent extraction of actual ints from the single long int with bit shifts or bit masks).

Also, is it possible to work with 128 bit ints (texture<long long, 1, cudaReadModeElementType> texInput) ?

Thanks in advance.

I don’t believe you can read long ints from a texture. You can use int2 for reads of 2 integers or int4 for reads of 4 integers. If you can, use int4: the texturing engine of the GPU can only provide so many texture reads/second so if you read int4 you can potentially get a higher effective bandwidth from the cache.

Tried it out …

Overhead with int2 (special index calculations, access to the int2 fields e t c) avoids all the profit of lesser number of tex1dfetch calls (if such profit exists at all).

Looks like there is no difference between single fetch and multiple fetches if requested values are well cached.