.tex u32

Is it normal that this:

texture<float4, 1, cudaReadModeElementType> gc_tex;

will be converted to PTX as

.tex .u32 gc_tex;

and not as

.tex .f32 gc_tex;

???

I’m using later

int p=0;

float4 rgba = tex1Dfetch(p);

to fetch it, which translates to

tex.1d.v4.f32.s32 {$f27,$f28,$f29,$f30},gc_tex,{$r33,$r34,$r35,$r36}

… won’t be better to declare the texture 1D as “.tex .f32 gc_tex” and save the fetch texture conversion from u32 to f32?

There shouldn’t be a conversion. Type of declarables are no longer important at ptx level.

Actually, the only example in the PTX doc (on p23) doesn’t use any type when declaring the texture. It looks like an error on the part of the compiler for it to even put a type in.

also, the instruction
text.1d.v4.f32.s32
means that the format is a 4-vectory of f32, and that the texture coordinates are s32. If the destination registers aren’t f32 the thing won’t compile.

Anyway, although the type of the texture doesn’t seem to matter, the types of the registers definately do. Ptx instructions are type-specific and don’t do automatic casting.