Skip to content

Commit

Permalink
make nvidia_hip_runtime_api work with CUDA 12
Browse files Browse the repository at this point in the history
guard calls to deleted functions in `if` directives.

Fixes: ROCm#73
  • Loading branch information
garymm committed May 18, 2023
1 parent 4209792 commit 1a3ac38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/hip/nvidia_detail/nvidia_hip_runtime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2792,6 +2792,7 @@ inline static hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t
return hipCUDAErrorTohipError(cudaFuncSetCacheConfig(func, cacheConfig));
}

#if CUDA_VERSION < 12000
__HIP_DEPRECATED inline static hipError_t hipBindTexture(size_t* offset,
struct textureReference* tex,
const void* devPtr,
Expand All @@ -2805,6 +2806,7 @@ __HIP_DEPRECATED inline static hipError_t hipBindTexture2D(
const hipChannelFormatDesc* desc, size_t width, size_t height, size_t pitch) {
return hipCUDAErrorTohipError(cudaBindTexture2D(offset, tex, devPtr, desc, width, height, pitch));
}
#endif // CUDA_VERSION < 12000

inline static hipChannelFormatDesc hipCreateChannelDesc(int x, int y, int z, int w,
hipChannelFormatKind f) {
Expand Down Expand Up @@ -2837,10 +2839,12 @@ inline static hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDe
return hipCUDAErrorTohipError(cudaGetTextureObjectResourceDesc( pResDesc, textureObject));
}

#if CUDA_VERSION < 12000
__HIP_DEPRECATED inline static hipError_t hipGetTextureAlignmentOffset(
size_t* offset, const struct textureReference* texref) {
return hipCUDAErrorTohipError(cudaGetTextureAlignmentOffset(offset,texref));
}
#endif // CUDA_VERSION < 12000

inline static hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array)
{
Expand Down Expand Up @@ -3086,6 +3090,7 @@ inline static hipError_t hipOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
blockSize, dynamicSMemSize, flags));
}

#if CUDA_VERSION < 12000
template <class T, int dim, enum cudaTextureReadMode readMode>
inline static hipError_t hipBindTexture(size_t* offset, const struct texture<T, dim, readMode>& tex,
const void* devPtr, size_t size = UINT_MAX) {
Expand Down Expand Up @@ -3128,6 +3133,7 @@ __HIP_DEPRECATED inline static hipError_t hipBindTextureToArray(
struct texture<T, dim, readMode>& tex, hipArray_const_t array) {
return hipCUDAErrorTohipError(cudaBindTextureToArray(tex, array));
}
#endif // CUDA_VERSION < 12000

template <class T>
inline static hipChannelFormatDesc hipCreateChannelDesc() {
Expand Down

0 comments on commit 1a3ac38

Please sign in to comment.