10.13 Texturing Quick References
10.13.1 Hardware Capabilities
Hardware Limits
Capability |
SM 1.x |
SM 2.x |
Maximum width – 1D CUDA array |
8192 |
32768 |
Maximum width – 1D device memory |
227 |
|
Maximum width and number of layers – 1D layered texture |
8192×512 |
16384×2048 |
Maximum extents for 2D texture |
65536×32768 |
|
Maximum extents and number of layers – 2D layered texture |
8192× 8192× 512 |
16384× 16384× 2048 |
Maximum extents – 3D CUDA array |
2048×2048×2048 |
|
Maximum number of textures that may be bound to a kernel |
128 |
|
Maximum extents for a 2D surface reference bound to a CUDA kernel |
n/a |
8192× 8192 |
Maximum number of surfaces that may be bound to a kernel |
|
8 |
Queries – Driver API
Most of the hardware limits listed above can be queried with cuDeviceAttribute() may called with the follow values to query.
Attribute |
CUdevice_attribute value |
Maximum width – 1D CUDA array |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH |
Maximum width of 1D layered texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_WIDTH |
Maximum number of layers of 1D layered texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_LAYERED_LAYERS |
Maximum width of 2D texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_WIDTH |
Maximum height of 2D texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_HEIGHT |
Maximum width of 2D layered texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_WIDTH |
Maximum height of 2D layered texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_HEIGHT |
Maximum number of layers of 2D layered texture |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE2D_LAYERED_LAYERS |
Maximum width – 3D CUDA array |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_WIDTH |
Maximum height – 3D CUDA array |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_HEIGHT |
Maximum depth – 3D CUDA array |
CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE3D_DEPTH |
Queries – CUDA Runtime
The following members of cudaDeviceProp contain hardware limits as listed above.
Capability |
cudaDeviceProp member |
Maximum width – 1D CUDA array |
int maxTexture1D; |
Maximum width and number of layers – 1D layered texture |
int maxTextureLayered[2]; |
Maximum extents for 2D texture |
int maxTexture2D[2]; |
Maximum extents and number of layers – 2D layered texture |
int maxTextureLayered[2]; |
Maximum extents – 3D CUDA array |
int maxTexture3D[3]; |
10.13.2 CUDA Runtime
1D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
cudaMalloc() |
cudaMallocArray() |
Free with... |
cudaFree() |
cudaFreeArray() |
Bind with... |
cudaBindTexture() |
cudaBindTextureToArray() |
Texture with... |
tex1Dfetch() |
tex1D() |
2D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
cudaMallocPitch() |
cudaMalloc2DArray()* |
Free with... |
cudaFree() |
cudaFreeArray() |
Bind with... |
cudaBindTexture2D() |
cudaBindTextureToArray() |
Texture with... |
tex2D() |
* if surface load/store is desired, specify the cudaArraySurfaceLoadStore flag.
3D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cudaMalloc3DArray() |
Free with... |
|
cudaFreeArray() |
Bind with... |
|
cudaBindTextureToArray() |
Texture with... |
|
tex3D() |
1D Layered Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cudaMalloc2DArray()- specify cudaArrayLayered. |
Free with... |
|
cudaFreeArray() |
Bind with... |
|
cudaBindTextureToArray() |
Texture with... |
|
tex1DLayered() |
2D Layered Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cudaMalloc3DArray()- specify cudaArrayLayered. |
Free with... |
|
cudaFreeArray() |
Bind with... |
|
cudaBindTextureToArray() |
Texture with... |
|
tex1DLayered() |
10.13.3 Driver API
1D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
cuMemAlloc() |
cuArrayCreate() |
Free with... |
cuMemFree() |
cuArrayDestroy() |
Bind with... |
cuTexRefSetAddress() |
cuTexRefSetArray() |
Texture with... |
tex1Dfetch() |
tex1D() |
Size Limit |
227 elements (128M) |
65536 |
The texture size limit for device memory is not queryable; it is 227 elements on all CUDA-capable GPUs.
The texture size limit for 1D CUDA arrays may be queried by calling cuDeviceGetAttribute() with CU_DEVICE_ATTRIBUTE_MAXIMUM_TEXTURE1D_WIDTH.
2D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
cuMemAllocPitch() |
cuArrayCreate() |
Free with... |
cuMemFree() |
cudaFreeArray() |
Bind with... |
cuTexRefSetAddress2D() |
cuTexRefSetArray() |
Texture with... |
tex2D() |
3D Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cudaMalloc3DArray() |
Free with... |
|
cudaFreeArray() |
Bind with... |
|
cudaBindTextureToArray() |
Texture with... |
|
tex3D() |
1D Layered Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cuArray3DCreate()- specify CUDA_ARRAY3D_LAYERED |
Free with... |
|
cudaFreeArray() |
Bind with... |
|
cuTexRefSetArray() |
Texture with... |
|
tex1DLayered() |
2D Layered Textures
Operation |
Device Memory |
CUDA Arrays |
Allocate with... |
(not supported) |
cuArray3DCreate()- specify CUDA_ARRAY3D_LAYERED |
Free with... |
|
cuArrayDestroy() |
Bind with... |
|
cuTexRefSetArray() |
Texture with... |
|
tex2DLayered() |