The code is like this: a = share[idx]; “a” is stored in a register and “share” is stored in shared memory.
The “a” register does not really exist. In fact, the program will visit shared memory when “a” is used;
Actually this question has been raised before. I have tried “volatile” variables but it does not work. Another way seems to be to modify the assembly code.
Is there any other method? I will very appreciate your help.