texture memory and shared memory


Texture memory seems to be treated as shared memory. I think it is a bug, isn’t it?

Here is a code which met memory access error:

global void textureMemoryAbs(int w, int h)
int x = threadIdx.x + blockDim.xblockIdx.x;
int y = threadIdx.y + blockDim.y

if (x < w && y < h) {
	unsigned char a_local = tex2D(texPrev, (float)x, (float)y);
	unsigned char b_local = tex2D(texCurr, (float)x, (float)y);

	int abs_local = abs((int)a_local - (int)b_local);
	//printf("[%d][%d] %d \n", threadIdx.x, threadIdx.y, abs_local);


and this is a error message from nsight debuger.

CUDA Memory Checker detected 31 threads caused an access violation:
Launch Parameters
CUcontext = 04b8cd08
CUstream = 05e6a6b0
CUmodule = 01540c98
CUfunction = 0922d168
FunctionName = _Z16textureMemoryAbsii
GridId = 3
gridDim = {128,68,1}
blockDim = {32,32,1}
sharedSize = 256
w = 3840
h = 2160
Parameters (raw):
0x00000f00 0x00000870

In addition to the above question, what does this "sharedSize = 256 " mean?
I do not declare any shared memory in my code but I can still see the shared memory.

is there any clue?