Warning: expression has no effect Strange compiler warning on dim3

Hi everyone,

I’m compiling a simple CUDA code (CUDA 1.1, Windows XP, VisualStudio2005), and I get this strange warning:

1>"fftcudamain.cu", line 1125: warning: expression has no effect

1>   dim3   dimBlock = (16, 16, 1);

1>                      ^

1>"fftcudamain.cu", line 1136: warning: expression has no effect

1>   dimGrid  = (cols / dimBlock.x, rows / dimBlock.y, 1);

1>               ^

The corresponding source code is (relevant part only):

#define THREADSxBLOCK 16

dim3  	dimBlock	= (THREADSxBLOCK, THREADSxBLOCK, 1);

dim3  	dimGrid;

dimGrid	= (cols / dimBlock.x, rows / dimBlock.y, 1);

DInterleave<<<dimGrid, dimBlock>>>(dfpInRe, dfpInIm, deviceFC1, cols, rows);

Any suggestion? Is NVCC ignoring dimBlock and dimGrid and using default values (and why) ?



I believe that dim3 actually uses a constructor…i.e. the compiler expected

dim3 dimBlock(16, 16, 1);

and I don’t think you can use just an ordered pair to assign to them (at least I’ve never seen it done). You might try make_uint3(x,y,z), though I don’t know how well that will assign to the dim3 type.

That error message has a funny way of saying it, though!



Thanks!! :thumbup: