system lag on memory transaction

Hi there,

I have a little problem with some code snippet.

When I run the following code:

[codebox]

//avoiding shmem bank conflicts + coalesced device mem reading (4 Byte)

*(unsigned int *)(shared_mem + shmem_thread_index + INDEX_ENV_DATA + (MULPLEX_BYTES_MEM * j)) = //BUG

*(unsigned int *)(device_mem + dvmem_thread_index + 

(MULPLEX_BYTES_MEM * NUM_THREADS_PER_BLOCK * NUM_LOADABLE_ENV_PER_THREAD * i) +  

(MULPLEX_BYTES_MEM * NUM_THREADS_PER_BLOCK * j) );	//device mem part -> shared mem part

[/codebox]

from the kernel function, the system (x11) get freezed for some seconds afterwards the terminal emulator get some

grafic errors.

Dont worry about the constants, as I think they do not matter in here.

The interesting thing is, that I can write integers into the shared memory area as well as I can read the integers

from the device memory. Only the combination of both seems to fail.

For example this: (atest is a 4 byte long char array…)

[codebox]

*(unsigned int *)atest = *(unsigned int *)(device_mem + dvmem_thread_index +

(MULPLEX_BYTES_MEM * NUM_THREADS_PER_BLOCK * NUM_LOADABLE_ENV_PER_THREAD * i) +  

(MULPLEX_BYTES_MEM * NUM_THREADS_PER_BLOCK * j) );	//device mem part -> shared mem part

*(unsigned int *)atest = 2863311530; //0b10101010101010101010101010101010

*(unsigned int *)(shared_mem + shmem_thread_index + INDEX_ENV_DATA + (MULPLEX_BYTES_MEM * j)) = *(unsigned int *)atest;

[/codebox]

does work well, but if I cut the “*(unsigned int *)atest = 2863311530;” statement of the source, the problem will

be the same as before.

It seems like I write some data to reserved display memory but I think this will be in device memory…

For the case that I overwrite some important memory areas, where is the difference in overwriting it

with random data and a constant number? :wacko:

Thanks for your help and your ideas.