Search code examples
cachingtexturescuda

Can CUDA texture memory be used for 32 Bytes elements?


I wonder whether texture memory can be used for 32 bytes struct?

Some friends told me that the largest element is uint4, which is 16 bytes.

Could you give me some advice?


Solution

  • See section 3.2.10.1.1 of the CUDA C Programming Guide:

    DataType specifies the type of data that is returned when fetching the texture; Type is restricted to the basic integer and single-precision floating-point types and any of the 1-, 2-, and 4-component vector types defined in Section B.3.1;

    In other words: no, you cannot use it for 32 bytes since the largest of the vector types defined is 16 bytes. Also note that you cannot use arbitrary structs, textures only work with a limited set of types.