__constant__ struggle continues - 1 byte shift

2nd week passing by while I am still trying to migrate my app to latest SDK :-)
Currently I’ve faced strange issue: constant get shifted by 1 byte (i.e. small values are multiplied by 256).
That is totally crazy :-) Any ideas how this might happen?

I set it like this:

int test[4];
test[0]=123;
test[1]=234;
test[2]=345;
test[3]=456;
cudaMemcpyToSymbol(target_hash, test, sizeof(int)*4, cudaMemcpyHostToDevice);

//also tried “target_hash”

And read it like this:

ta = target_hash[0];

ta here is 31488

Any ideas?

Same shift if test is global.

Same with SDK 2.2.

Also, it’s defenetly shift, set [3] to 0xffffffff, and got 0xffffff00

Same behavior with Intel C++ instead of MSVC 2008.
test is 16-byte aligned.

When I switch it to device variable, everything works fine (although a bit slower).

Damn, guys, looks like I’ll win free ticket to mental hospital with CUDA :-)

This works perfect: cudaMemcpyToSymbol(“target_hash”, hash_i, sizeof(int)*4);
This have 1 byte shift: cudaMemcpyToSymbol(“target_hash”, hash_i, sizeof(int)*4, cudaMemcpyHostToDevice);

Anyone from nvidia? Or other clues? :-)

http://forums.nvidia.com/index.php?showtopic=109435

Thanks, that was awesome :-)