SWDEV-384100 - HIP support for CUDA 12.0

Apps are failing to build due to undefined deprecated texture APIs

Change-Id: I1fb64adc4bc0ba6ee6ecaa65d54b34da0327e6a3
This commit is contained in:
Ajay
2023-02-17 22:46:39 +00:00
committed by Ajay GunaShekar
parent 348698ed30
commit fc6a77a09f
@@ -39,6 +39,7 @@ THE SOFTWARE.
#define CUDA_11030 11030 #define CUDA_11030 11030
#define CUDA_11040 11040 #define CUDA_11040 11040
#define CUDA_11060 11060 #define CUDA_11060 11060
#define CUDA_12000 12000
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -2773,6 +2774,7 @@ inline static hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t
return hipCUDAErrorTohipError(cudaFuncSetCacheConfig(func, cacheConfig)); return hipCUDAErrorTohipError(cudaFuncSetCacheConfig(func, cacheConfig));
} }
#if CUDA_VERSION < CUDA_12000
__HIP_DEPRECATED inline static hipError_t hipBindTexture(size_t* offset, __HIP_DEPRECATED inline static hipError_t hipBindTexture(size_t* offset,
struct textureReference* tex, struct textureReference* tex,
const void* devPtr, const void* devPtr,
@@ -2786,6 +2788,8 @@ __HIP_DEPRECATED inline static hipError_t hipBindTexture2D(
const hipChannelFormatDesc* desc, size_t width, size_t height, size_t pitch) { const hipChannelFormatDesc* desc, size_t width, size_t height, size_t pitch) {
return hipCUDAErrorTohipError(cudaBindTexture2D(offset, tex, devPtr, desc, width, height, pitch)); return hipCUDAErrorTohipError(cudaBindTexture2D(offset, tex, devPtr, desc, width, height, pitch));
} }
#endif // CUDA_VERSION < CUDA_12000
inline static hipChannelFormatDesc hipCreateChannelDesc(int x, int y, int z, int w, inline static hipChannelFormatDesc hipCreateChannelDesc(int x, int y, int z, int w,
hipChannelFormatKind f) { hipChannelFormatKind f) {
@@ -2818,10 +2822,12 @@ inline static hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDe
return hipCUDAErrorTohipError(cudaGetTextureObjectResourceDesc( pResDesc, textureObject)); return hipCUDAErrorTohipError(cudaGetTextureObjectResourceDesc( pResDesc, textureObject));
} }
#if CUDA_VERSION < CUDA_12000
__HIP_DEPRECATED inline static hipError_t hipGetTextureAlignmentOffset( __HIP_DEPRECATED inline static hipError_t hipGetTextureAlignmentOffset(
size_t* offset, const struct textureReference* texref) { size_t* offset, const struct textureReference* texref) {
return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref)); return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
} }
#endif
inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array) inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array)
{ {
@@ -3067,6 +3073,7 @@ inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
blockSize, dynamicSMemSize, flags)); blockSize, dynamicSMemSize, flags));
} }
#if CUDA_VERSION < CUDA_12000
template <class T, int dim, enum cudaTextureReadMode readMode> template <class T, int dim, enum cudaTextureReadMode readMode>
inline static hipError_t hipBindTexture(size_t* offset, const struct texture<T, dim, readMode>& tex, inline static hipError_t hipBindTexture(size_t* offset, const struct texture<T, dim, readMode>& tex,
const void* devPtr, size_t size = UINT_MAX) { const void* devPtr, size_t size = UINT_MAX) {
@@ -3109,6 +3116,7 @@ __HIP_DEPRECATED inline static hipError_t hipBindTextureToArray(
struct texture<T, dim, readMode>& tex, hipArray_const_t array) { struct texture<T, dim, readMode>& tex, hipArray_const_t array) {
return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array)); return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array));
} }
#endif // CUDA_VERSION < CUDA_12000
template <class T> template <class T>
inline static hipChannelFormatDesc hipCreateChannelDesc() { inline static hipChannelFormatDesc hipCreateChannelDesc() {