I am using a 1D texture to specify material properties on a 2D grid. Each point in the texture has a one to one correspondence to the simulation space. Am I slowing down my texture memory access by using a 1D texture?
Is there still a maximum size for linear textures of 256^2 elements? This is not mentioned anywhere in the programming guide but I have seen it mentioned elsewhere and my simulation seems to die if I go above 256^2 elements.
I have heard that I can only bind a 2D texture to a 2D array and not a 1D array. Is this true?
That depends on your access patterns. 2D textures are optimized to profit from 2D locality in your accesses. If the 2D->1D mapping you use preserves or even increases locality for the accesses to the 1D texture, you are fine.
Most certainly not. I definitely use 1D textures with more that 65536 elements.
I have no experience with this.
I have seen it said that texture memories want 2D spatial locality explicitly and exclusively. Why do they say this if as you say, a 1D spatial locality is just as good?
That applies to the 2D case. As the name ‘texture’ already implies a 2D nature, this often is what people think of first.
In the end, memory addressing is always 1D, so all you want is 1D locality in the memory addresses used. Now it is just a question how to achieve this: Do you use the (undocumented, but presumably quite good at least for graphics) mapping that Nvidia implemented in their hardware, or do you use your own mapping. The common [font=“Courier New”]arr[y*x_size+x][/font] mapping obviously is a bad mapping if the threads of a warp use different [font=“Courier New”]y[/font], but a good one if all use the same [font=“Courier New”]y[/font].
[y*x_size+x] is the mapping I use, and the threads are accessed in exactly the same manner. Thread 1 accesses space 1, thread 2 accesses space 2, etc.
Do you think the discussion in this thread is out of date?
I am using a Tesla 1060c, I don’t know how these things have changed.