I have seen that CUDA 12.0 is out.
I have some questions.
(1) Does CUDA 12.0 Still support the (legacy) “Texture Reference” API ?
Example: “texture<float, 1, cudaReadModeElementType> tex;”
(2) Does CUDA 12.0 still support Pascal architecture ?
(Pascal architecture is the last architecture which ensures warp-synchronous programming behaviour when compiling against it)
The reason is that we have a lot of CUDA code which uses texture references and assumes warp-synchronous behaviour.
Often in third-party code, which we do not really understand (e.g. GPU implementations of highly sophisticated variational optical flow algorithms).
(1) according to my testing, texture reference support has been removed from CUDA 12.0. A program that compiles correctly (albeit with deprecation warnings) under CUDA 11.8 now results in these compile errors:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Mon_Oct_24_19:12:58_PDT_2022
Cuda compilation tools, release 12.0, V12.0.76
$ nvcc -o t26 t26.cu
t26.cu(10): error: texture is not a template
t26.cu(14): error: no instance of overloaded function "tex3D" matches the argument list
argument types are: (<error-type>, float, float, float)
t26.cu(61): error: identifier "cudaBindTextureToArray" is undefined
t26.cu(81): error: identifier "cudaUnbindTexture" is undefined
4 errors detected in the compilation of "t26.cu".
(2) the only GPU architecture support removed in 12.0 is kepler. FWIW,
nvcc in CUDA 12.0 still supports
sm_50 as a compilation target, and still targets
sm_52 by default (if no arch target specification is given.) I’m not making any statements about warp-synchronous programming. That has been discouraged for some time now. YMMV.
Thank you for the faster answer. As mentioned, this (texture references) is often in third-party libraries which we compile by ourself. Not easy to change. One example: the CUDA implementation of the ‘Brox’ optical flow algorithm in the OpenCV library. The maintainers of that algorithm will have a lot of work porting everthing to texture objects …
And that’s only one example.
Same applies for warp-synchronous programming, although it’s good that CUDA 12 still supports pascal architecture compilation targets.
CUDA programmers have had many years to adjust their respective code bases.
Texture objects were introduced ten years ago, in CUDA 5.0. Since that time NVIDIA has consistently indicated that these provide a superior alternative to texture references, and that it ultimately will remove support for texture references.
Warp-synchronous programming has been officially declared unsafe by NVIDIA for at least five years (see this blog post, for example), and I personally have discouraged it for as long as it has been around (including internally at NVIDIA when I worked there), as it was based on an implementation artifact that was around for a number of years but ultimately went away.
Given that CUDA 12.0 still supports
sm_5x (Maxwell) per the post above, it seems reasonable to assume that support for Pascal (
sm_6x) will not be removed for a couple more years.
It would be great with a pointer to documentation on how to transition code that uses the old texture template into something that compiles using the new API.
I have seen codes in the public domain using this and would like to be able to make them usable still. I am a reasonably skilled HPC programmer, but limited CUDA knowledge. I think that with the help of a transition guide I could perhaps fix a few of these codes.
I have tried searching for it, but not found anything yet.
The canonical blog article is here. It is intended to teach developers who were familiar with texture reference usage, how to use texture objects.
You can also find CUDA sample codes that demonstrate texture object usage, such as this one.
That (simplePitchLinearTexture.cu) was an excellent sample for my needs!