In what case, using text mem is slower than not using?

the project is doing a spmv, the size of Matrix G is 1000000 by 1000000, and when I stored x vector in global mem, it costed 8ms(whole cal time) while x stored in text mem costed 80ms.

In normal case, text mem fetch is faster than global mem, so i do not why i had the contrary results.

You can’t store(i.e write from kernel code) into texture memory. Textures are read-only.

So the question is not so clear - if you post the code the reason might be more clear.


Not true. You can write to them, but once you have you can’t guarentee that reads from the same location will give the correct result (as it doesn’t update the cache on write).

Texture memory is faster if you are good at hitting the cache - ie. your data structure has good 2d spacial locality. I don’t think it ever beats simple coalesced global memory access though. I would have thought spmv would have quite uncoalesced x, so I would have thought that it would help. Clearly not in your case.

You can not directly write to a texture but to linear memory associated with it. When linear memory is written at, then the next pass reflects the changes while reading through the texture. i.e modifications are not immediately visible.