From c62396e22bd60a516ba7945e42f53accefc44586 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 08:07:17 -0500 Subject: [PATCH 01/19] Get compiling for CUDART 12000 --- plugins/cublas/backend/CublasHandler.h | 2 +- .../cublas/backend/CublasHandler_Level2.cpp | 16 +- plugins/cublas/frontend/CublasFrontend.h | 4 +- plugins/cudart/CMakeLists.txt | 44 ++++- plugins/cudart/backend/CudaRtHandler.cpp | 22 ++- plugins/cudart/backend/CudaRtHandler.h | 11 +- .../cudart/backend/CudaRtHandler_internal.cpp | 15 +- plugins/cudart/frontend/CudaRt_internal.cpp | 6 + plugins/cudnn/backend/CudnnHandler.cpp | 156 +++++++++++++++--- plugins/cudnn/frontend/Cudnn.cpp | 18 +- 10 files changed, 248 insertions(+), 46 deletions(-) diff --git a/plugins/cublas/backend/CublasHandler.h b/plugins/cublas/backend/CublasHandler.h index 4547e48f..e3784901 100644 --- a/plugins/cublas/backend/CublasHandler.h +++ b/plugins/cublas/backend/CublasHandler.h @@ -40,7 +40,7 @@ #include #include -#include +//#include #include "cublas_v2.h" #include diff --git a/plugins/cublas/backend/CublasHandler_Level2.cpp b/plugins/cublas/backend/CublasHandler_Level2.cpp index 9a24dc06..2ed855b8 100644 --- a/plugins/cublas/backend/CublasHandler_Level2.cpp +++ b/plugins/cublas/backend/CublasHandler_Level2.cpp @@ -852,7 +852,7 @@ CUBLAS_ROUTINE_HANDLER(Ssbmv_v2){ float * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasSsbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); + cublasStatus_t cs = cublasSsbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -874,7 +874,7 @@ CUBLAS_ROUTINE_HANDLER(Dsbmv_v2){ double * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasDsbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); + cublasStatus_t cs = cublasDsbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -896,7 +896,7 @@ CUBLAS_ROUTINE_HANDLER(Chbmv_v2){ cuComplex * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasChbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); + cublasStatus_t cs = cublasChbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -918,7 +918,7 @@ CUBLAS_ROUTINE_HANDLER(Zhbmv_v2){ cuDoubleComplex * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasZhbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); + cublasStatus_t cs = cublasZhbmv_v2(handle,uplo,n,k,alpha,A,lda,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -938,7 +938,7 @@ CUBLAS_ROUTINE_HANDLER(Sspmv_v2){ float * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasSspmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); + cublasStatus_t cs = cublasSspmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -958,7 +958,7 @@ CUBLAS_ROUTINE_HANDLER(Dspmv_v2){ double * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasDspmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); + cublasStatus_t cs = cublasDspmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -978,7 +978,7 @@ CUBLAS_ROUTINE_HANDLER(Chpmv_v2){ cuComplex * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasChpmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); + cublasStatus_t cs = cublasChpmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); return std::make_shared(cs); } @@ -998,7 +998,7 @@ CUBLAS_ROUTINE_HANDLER(Zhpmv_v2){ cuDoubleComplex * y = in->GetFromMarshal(); int incy = in->Get(); - cublasStatus cs = cublasZhpmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); + cublasStatus_t cs = cublasZhpmv_v2(handle,uplo,n,alpha,AP,x,incx,beta,y,incy); return std::make_shared(cs); } diff --git a/plugins/cublas/frontend/CublasFrontend.h b/plugins/cublas/frontend/CublasFrontend.h index 1908bdc6..3bbbf2e9 100644 --- a/plugins/cublas/frontend/CublasFrontend.h +++ b/plugins/cublas/frontend/CublasFrontend.h @@ -25,8 +25,8 @@ #ifndef CUBLASFRONTEND_H #define CUBLASFRONTEND_H -#include -#include +// #include +// #include #include "cublas_v2.h" #include diff --git a/plugins/cudart/CMakeLists.txt b/plugins/cudart/CMakeLists.txt index 914afba1..4e8ab979 100644 --- a/plugins/cudart/CMakeLists.txt +++ b/plugins/cudart/CMakeLists.txt @@ -30,6 +30,8 @@ string(REGEX REPLACE ".*\\.so\\.([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" CUDART_VERSION message(STATUS "Found cudaRt: ${CUDART_VERSION} (${CUDART_INCLUDE_DIRECTORY}/cuda_runtime_api.h, ${CUDART_LIBRARY})") +if (CUDART_VERSION LESS 12000) + gvirtus_add_backend(cudart ${CUDA_VERSION} backend/CudaRtHandler_texture.cpp backend/CudaRtHandler_event.cpp @@ -66,4 +68,44 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -add_subdirectory(demo) \ No newline at end of file +else (CUDART_VERSION LESS 12000) + +gvirtus_add_backend(cudart ${CUDA_VERSION} + # backend/CudaRtHandler_texture.cpp + backend/CudaRtHandler_event.cpp + backend/CudaRtHandler_opengl.cpp + # backend/CudaRtHandler_surface.cpp + backend/CudaRtHandler_thread.cpp + backend/CudaRtHandler_internal.cpp + backend/CudaRtHandler_occupancy.cpp + backend/CudaRtHandler_execution.cpp + backend/CudaRtHandler_device.cpp + backend/CudaRtHandler_stream.cpp + backend/CudaRtHandler_memory.cpp + backend/CudaRtHandler_version.cpp + backend/CudaRtHandler_error.cpp + backend/CudaRtHandler.cpp + util/CudaUtil.cpp) +target_link_libraries(${PROJECT_NAME} ${CUDA_CUDART_LIBRARY}) + +gvirtus_add_frontend(cudart ${CUDA_VERSION} + frontend/CudaRt.cpp + frontend/CudaRt_device.cpp + frontend/CudaRt_error.cpp + frontend/CudaRt_event.cpp + frontend/CudaRt_execution.cpp + frontend/CudaRtFrontend.cpp + frontend/CudaRt_internal.cpp + frontend/CudaRt_memory.cpp + frontend/CudaRt_occupancy.cpp + frontend/CudaRt_opengl.cpp + frontend/CudaRt_stream.cpp + # frontend/CudaRt_surface.cpp + # frontend/CudaRt_texture.cpp + frontend/CudaRt_thread.cpp + frontend/CudaRt_version.cpp + util/CudaUtil.cpp) + +endif (CUDART_VERSION LESS 12000) + +add_subdirectory(demo) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index 351bff19..b644f02e 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -59,8 +59,10 @@ CudaRtHandler::CudaRtHandler() { mpFatBinary = new map(); mpDeviceFunction = new map(); mpVar = new map(); +#if CUDART_VERSION < 12000 mpTexture = new map(); mpSurface = new map(); +#endif mapHost2DeviceFunc = new map(); mapDeviceFunc2InfoFunc = new map(); @@ -208,6 +210,7 @@ const char *CudaRtHandler::GetVar(const char *handler) { return GetVar(tmp); } +#if CUDART_VERSION < 12000 void CudaRtHandler::RegisterTexture(string &handler, textureReference *texref) { mpTexture->insert(make_pair(handler, texref)); //#ifdef DEBUG @@ -276,6 +279,7 @@ const char *CudaRtHandler::GetSurfaceHandler(surfaceReference *surfref) { if (it->second == surfref) return it->first.c_str(); return NULL; } +#endif const char *CudaRtHandler::GetSymbol(std::shared_ptr in) { char *symbol_handler = in->AssignString(); @@ -368,8 +372,10 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSharedVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterShared)); +#if (CUDART_VERSION < 12000) mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterTexture)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSurface)); +#endif /* CudaRtHandler_memory */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(Free)); @@ -415,31 +421,33 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(StreamWaitEvent)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(StreamCreateWithPriority)); +#ifndef CUDART_VERSION +#error CUDART_VERSION not defined +#endif +#if (CUDART_VERSION < 12000) /* CudaRtHandler_surface */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindSurfaceToArray)); /* CudaRtHandler_texture */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindTexture)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindTexture2D)); -#ifndef CUDART_VERSION -#error CUDART_VERSION not defined -#endif mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindTextureToArray)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(CreateTextureObject)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetChannelDesc)); - mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureAlignmentOffset)); - mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureReference)); - mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(UnbindTexture)); + // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureAlignmentOffset)); + // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureReference)); + // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(UnbindTexture)); +#endif /* CudaRtHandler_thread */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(ThreadExit)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(ThreadSynchronize)); - /* CudaRtHandler_version */ #ifndef CUDART_VERSION #error CUDART_VERSION not defined #endif #if CUDART_VERSION >= 2030 + /* CudaRtHandler_version */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(DriverGetVersion)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RuntimeGetVersion)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(FuncSetCacheConfig)); diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index 1cca403a..4d16edd9 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -59,6 +59,7 @@ #include "../3rdparty/include/CudaRt_internal.h" +#if (CUDART_VERSION < 12000) #if (CUDART_VERSION >= 9020) #if (CUDART_VERSION >= 11000) #define __CUDACC__ @@ -66,6 +67,7 @@ #endif #include "crt/device_functions.h" #endif +#endif //#define DEBUG @@ -109,6 +111,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { const char *GetVar(std::string &handler); const char *GetVar(const char *handler); +#if (CUDART_VERSION < 12000) void RegisterTexture(std::string &handler, textureReference *texref); void RegisterTexture(const char *handler, textureReference *texref); void RegisterSurface(std::string &handler, surfaceReference *surref); @@ -121,6 +124,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { surfaceReference *GetSurface(pointer_t handler); surfaceReference *GetSurface(const char *handler); const char *GetSurfaceHandler(surfaceReference *texref); +#endif const char *GetSymbol(std::shared_ptr in); @@ -168,8 +172,10 @@ class CudaRtHandler : public gvirtus::backend::Handler { std::map *mpFatBinary; std::map *mpDeviceFunction; std::map *mpVar; +#if (CUDART_VERSION < 12000) std::map *mpTexture; std::map *mpSurface; +#endif map* mapDeviceFunc2InfoFunc; map* mapHost2DeviceFunc; void *mpShm; @@ -242,8 +248,10 @@ CUDA_ROUTINE_HANDLER(RegisterFunction); CUDA_ROUTINE_HANDLER(RegisterVar); CUDA_ROUTINE_HANDLER(RegisterSharedVar); CUDA_ROUTINE_HANDLER(RegisterShared); +#if (CUDART_VERSION < 12000) CUDA_ROUTINE_HANDLER(RegisterTexture); CUDA_ROUTINE_HANDLER(RegisterSurface); +#endif CUDA_ROUTINE_HANDLER(RegisterSharedMemory); CUDA_ROUTINE_HANDLER(RequestSharedMemory); @@ -290,6 +298,7 @@ CUDA_ROUTINE_HANDLER(StreamCreateWithFlags); CUDA_ROUTINE_HANDLER(StreamWaitEvent); CUDA_ROUTINE_HANDLER(StreamCreateWithPriority); +#if (CUDART_VERSION < 12000) /* CudaRtHandler_texture */ CUDA_ROUTINE_HANDLER(BindTexture); CUDA_ROUTINE_HANDLER(BindTexture2D); @@ -302,7 +311,7 @@ CUDA_ROUTINE_HANDLER(UnbindTexture); /* CudaRtHandler_surface */ CUDA_ROUTINE_HANDLER(BindSurfaceToArray); -// CUDA_ROUTINE_HANDLER(GetTextureReference); +#endif /* CudaRtHandler_thread */ CUDA_ROUTINE_HANDLER(ThreadExit); diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 29d6288a..5afad63a 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -81,6 +81,7 @@ extern void __cudaRegisterVar(void **fatCubinHandle, char *hostVar, extern void __cudaRegisterSharedVar(void **fatCubinHandle, void **devicePtr, size_t size, size_t alignment, int storage); extern void __cudaRegisterShared(void **fatCubinHandle, void **devicePtr); +#if CUDART_VERSION < 12000 extern void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, char *deviceName, @@ -89,6 +90,7 @@ extern void __cudaRegisterSurface(void **fatCubinHandle, const surfaceReference *hostVar, void **deviceAddress, char *deviceName, int dim, int ext); +#endif } static bool initialized = false; @@ -97,8 +99,10 @@ static size_t constStrings_size = 0; static size_t constStrings_length = 0; // static void ** fatCubinHandlers[2048]; // static void * fatCubins[2048]; -// static const textureReference * texrefHandlers[2048]; -// static const textureReference * texref[2048]; +#if CUDART_VERSION < 12000 +static const textureReference * texrefHandlers[2048]; +static const textureReference * texref[2048]; +#endif static void init() { // constStrings_size = 2048; @@ -421,6 +425,7 @@ CUDA_ROUTINE_HANDLER(RegisterShared) { return std::make_shared(cudaSuccess); } +#if CUDART_VERSION < 12000 CUDA_ROUTINE_HANDLER(RegisterTexture) { try { char *handler = input_buffer->AssignString(); @@ -445,12 +450,12 @@ CUDA_ROUTINE_HANDLER(RegisterTexture) { cerr << "error executing RegisterTexture: " << _cudaGetErrorEnum(error) << endl; } -#endif } catch (string e) { cerr << e << endl; return std::make_shared(cudaErrorMemoryAllocation); } +#endif #if 0 try { @@ -506,14 +511,13 @@ CUDA_ROUTINE_HANDLER(RegisterSurface) { #if (CUDART_VERSION >= 9020) - #if (CUDART_VERSION >= 11000) #define __CUDACC__ #define cudaPushCallConfiguration __cudaPushCallConfiguration #endif -#include "crt/device_functions.h" +// #include "crt/device_functions.h" #include "CudaRt_internal.h" CUDA_ROUTINE_HANDLER(PushCallConfiguration) { @@ -573,3 +577,4 @@ CUDA_ROUTINE_HANDLER(PopCallConfiguration) { } #endif +#endif diff --git a/plugins/cudart/frontend/CudaRt_internal.cpp b/plugins/cudart/frontend/CudaRt_internal.cpp index 801e33de..35bcdd3d 100644 --- a/plugins/cudart/frontend/CudaRt_internal.cpp +++ b/plugins/cudart/frontend/CudaRt_internal.cpp @@ -219,6 +219,7 @@ extern "C" __host__ void __cudaRegisterSharedVar(void **fatCubinHandle, CudaRtFrontend::Execute("cudaRegisterSharedVar"); } +#if 0 extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, @@ -237,7 +238,9 @@ extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, CudaRtFrontend::AddVariableForArguments(ext); CudaRtFrontend::Execute("cudaRegisterTexture"); } +#endif +#if 0 extern "C" __host__ void __cudaRegisterSurface(void **fatCubinHandle, const surfaceReference *hostVar, void **deviceAddress, @@ -255,6 +258,7 @@ extern "C" __host__ void __cudaRegisterSurface(void **fatCubinHandle, CudaRtFrontend::AddVariableForArguments(ext); CudaRtFrontend::Execute("cudaRegisterSurface"); } +#endif /* */ @@ -265,12 +269,14 @@ extern "C" __host__ int __cudaSynchronizeThreads(void **x, void *y) { return 0; } +#if 0 extern "C" __host__ void __cudaTextureFetch(const void *tex, void *index, int integer, void *val) { // FIXME: implement std::cerr << "*** Error: __cudaTextureFetch() not yet implemented!" << std::endl; } +#endif #if CUDA_VERSION >= 9000 extern "C" __host__ __device__ unsigned CUDARTAPI __cudaPushCallConfiguration(dim3 gridDim, dim3 blockDim, size_t sharedMem = 0, void *stream = 0) { diff --git a/plugins/cudnn/backend/CudnnHandler.cpp b/plugins/cudnn/backend/CudnnHandler.cpp index 4173666d..ddbeeb75 100644 --- a/plugins/cudnn/backend/CudnnHandler.cpp +++ b/plugins/cudnn/backend/CudnnHandler.cpp @@ -4027,7 +4027,75 @@ CUDNN_ROUTINE_HANDLER(DestroyRNNDescriptor){ return std::make_shared(cs, out); } #endif -#if CUDNN_VERSION >= 6000 + +#if CUDNN_VERSION >= 9500 +// TODO: implement +#elif CUDNN_VERSION >= 9000 +CUDNN_ROUTINE_HANDLER(SetRNNDescriptor){ + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNDescriptor")); + + cudnnHandle_t handle = (cudnnHandle_t)in->Get(); + cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); + int hiddenSize = in->Get(); + int numLayers = in->Get(); + cudnnDropoutDescriptor_t dropoutDesc = (cudnnDropoutDescriptor_t)in->Get(); + cudnnRNNInputMode_t inputMode = in->Get(); + cudnnDirectionMode_t direction = in->Get(); + cudnnRNNMode_t mode = in->Get(); + cudnnRNNAlgo_t algo = in->Get(); + cudnnDataType_t mathPrec = in->Get(); + + cudnnStatus_t cs = cudnnSetRNNDescriptor(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, mathPrec); + + std::shared_ptr out = std::make_shared(); + try{ + out->Add(rnnDesc); + } catch(string e){ + LOG4CPLUS_DEBUG(logger, e); + return std::make_shared(cs); + } + + LOG4CPLUS_DEBUG(logger, "cudnnSetRNNDescriptor Executed"); + //cout << " DEBUG - cudnnSetRNNDescriptor Executed"<(cs, out); +} + +CUDNN_ROUTINE_HANDLER(GetRNNDescriptor){ + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNDescriptor")); + + cudnnHandle_t handle = (cudnnHandle_t)in->Get(); + cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); + int hiddenSize; + int numLayers; + cudnnDropoutDescriptor_t dropoutDesc; + cudnnRNNInputMode_t inputMode; + cudnnDirectionMode_t direction; + cudnnRNNMode_t mode; + cudnnRNNAlgo_t algo; + cudnnDataType_t mathPrec; + + cudnnStatus_t cs = cudnnGetRNNDescriptor(handle, rnnDesc, &hiddenSize, &numLayers, &dropoutDesc, &inputMode, &direction, &mode, &algo, &mathPrec); + + std::shared_ptr out = std::make_shared(); + try{ + out->Add(hiddenSize); + out->Add(numLayers); + out->Add(dropoutDesc); + out->Add(inputMode); + out->Add(direction); + out->Add(mode); + out->Add(algo); + out->Add(mathPrec); + } catch(string e){ + LOG4CPLUS_DEBUG(logger, e); + return std::make_shared(cs); + } + + LOG4CPLUS_DEBUG(logger, "cudnnGetRNNDescriptor Executed"); + //cout << " DEBUG - cudnnGetRNNDescriptor Executed"<(cs, out); +} +#elif (CUDNN_VERSION >= 6000) CUDNN_ROUTINE_HANDLER(SetRNNDescriptor_v6){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNDescriptor_v6")); @@ -4198,6 +4266,7 @@ CUDNN_ROUTINE_HANDLER(GetRNNDescriptor_v8) { } #endif +#if CUDNN_VERSION < 9500 CUDNN_ROUTINE_HANDLER(SetRNNMatrixMathType){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNMatrixMathType")); @@ -4300,6 +4369,7 @@ CUDNN_ROUTINE_HANDLER(RNNSetClip){ return std::make_shared(cs, out); } + CUDNN_ROUTINE_HANDLER(RNNGetClip){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNGetClip")); @@ -4521,27 +4591,27 @@ CUDNN_ROUTINE_HANDLER(GetRNNLinLayerMatrixParams){ } CUDNN_ROUTINE_HANDLER(GetRNNLinLayerBiasParams){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); - cudnnHandle_t handle = (cudnnHandle_t)in->Get(); - cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); - int pseudoLayer = in->Get(); - cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); - cudnnFilterDescriptor_t wDesc = (cudnnFilterDescriptor_t)in->Get(); - void *w = in->Assign(); - int linLayerID = in->Get(); - cudnnFilterDescriptor_t linLayerBiasDesc; - void *linLayerBias; + cudnnHandle_t handle = (cudnnHandle_t)in->Get(); + cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); + int pseudoLayer = in->Get(); + cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); + cudnnFilterDescriptor_t wDesc = (cudnnFilterDescriptor_t)in->Get(); + void *w = in->Assign(); + int linLayerID = in->Get(); + cudnnFilterDescriptor_t linLayerBiasDesc; + void *linLayerBias; - cudnnStatus_t cs = cudnnGetRNNLinLayerBiasParams(handle, rnnDesc, pseudoLayer, xDesc, wDesc, w, linLayerID, linLayerBiasDesc, &linLayerBias); + cudnnStatus_t cs = cudnnGetRNNLinLayerBiasParams(handle, rnnDesc, pseudoLayer, xDesc, wDesc, w, linLayerID, linLayerBiasDesc, &linLayerBias); - std::shared_ptr out = std::make_shared(); - try{ - out->Add(linLayerBiasDesc); - out->Add(linLayerBias); - } catch(string e){ - LOG4CPLUS_DEBUG(logger, e); - return std::make_shared(cs); + std::shared_ptr out = std::make_shared(); + try { + out->Add(linLayerBiasDesc); + out->Add(linLayerBias); + } catch (string e){ + LOG4CPLUS_DEBUG(logger, e); + return std::make_shared(cs); } LOG4CPLUS_DEBUG(logger, "cudnnGetRNNLinLayerBiasParams Executed"); @@ -4755,6 +4825,49 @@ CUDNN_ROUTINE_HANDLER(GetRNNPaddingMode){ //cout << " DEBUG - cudnnGetRNNPaddingMode Executed"<(cs, out); } +#else +CUDNN_ROUTINE_HANDLER(GetRNNLinLayerBiasParams){ + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); + + cudnnHandle_t handle = (cudnnHandle_t)in->Get(); + cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); + int pseudoLayer = in->Get(); + size_t weightSpaceSize = (size_t)in->Get(); + void *weights = in->Assign(); + int linLayerID = in->Get(); + cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); + void *x; + cudnnTensorDescriptor_t wDesc = (cudnnTensorDescriptor_t)in->Get(); + void *w; + + cudnnStatus_t cs = cudnnGetRNNWeightParams(handle, rnnDesc, pseudoLayer, weightSpaceSize, weights, linLayerID, xDesc, &x, wDesc, &w); + + std::shared_ptr out = std::make_shared(); + try { + out->Add(x); + out->Add(w); + } catch (string e){ + LOG4CPLUS_DEBUG(logger, e); + return std::make_shared(cs); + } + + LOG4CPLUS_DEBUG(logger, "cudnnGetRNNLinLayerBiasParams Executed"); + //cout << " DEBUG - cudnnGetRNNLinLayerBiasParams Executed"<(cs, out); +} + +CUDNN_ROUTINE_HANDLER(RNNForward){ + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNForward")); + LOG4CPLUS_DEBUG(logger, " cudnnRNNForward not implemented"); + throw std::logic_error("cudnnRNNForward not implemented"); +} + +CUDNN_ROUTINE_HANDLER(RNNBackward){ + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNBackward")); + LOG4CPLUS_DEBUG(logger, " cudnnRNNBackward not implemented"); + throw std::logic_error("cudnnRNNBackward not implemented"); +} +#endif CUDNN_ROUTINE_HANDLER(CreateRNNDataDescriptor){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("CreateRNNDataDescriptor")); @@ -4851,6 +4964,7 @@ CUDNN_ROUTINE_HANDLER(GetRNNDataDescriptor){ return std::make_shared(cs, out); } +#if CUDNN_VERSION < 9500 CUDNN_ROUTINE_HANDLER(RNNForwardTrainingEx){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNForwardTrainingEx")); @@ -5271,7 +5385,6 @@ CUDNN_ROUTINE_HANDLER(FindRNNBackwardDataAlgorithmEx){ return std::make_shared(cs, out); } - CUDNN_ROUTINE_HANDLER(GetRNNBackwardWeightsAlgorithmMaxCount){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNBackwardWeightsAlgorithmMaxCount")); @@ -5331,6 +5444,7 @@ CUDNN_ROUTINE_HANDLER(FindRNNBackwardWeightsAlgorithmEx){ //cout << " DEBUG - cudnnFindRNNBackwardWeightsAlgorithmEx Executed"<(cs, out); } +#endif CUDNN_ROUTINE_HANDLER(CreateSeqDataDescriptor){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("CreateSeqDataDescriptor")); @@ -5923,6 +6037,7 @@ CUDNN_ROUTINE_HANDLER(GetCTCLossWorkspaceSize){ return std::make_shared(cs, out); } +#if CUDNN_VERSION < 9500 CUDNN_ROUTINE_HANDLER(CreateAlgorithmDescriptor){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("CreateAlgorithmDescriptor")); @@ -6136,6 +6251,7 @@ CUDNN_ROUTINE_HANDLER(RestoreAlgorithm){ //cout << " DEBUG - cudnnRestoreAlgorithm Executed"<(cs); } +#endif CUDNN_ROUTINE_HANDLER(SetCallback){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetCallback")); diff --git a/plugins/cudnn/frontend/Cudnn.cpp b/plugins/cudnn/frontend/Cudnn.cpp index c698dc82..5a512025 100644 --- a/plugins/cudnn/frontend/Cudnn.cpp +++ b/plugins/cudnn/frontend/Cudnn.cpp @@ -3616,6 +3616,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNProjectionLayers(cudnnHandle_t h return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreatePersistentRNNPlan(cudnnRNNDescriptor_t rnnDesc, const int minibatch, const cudnnDataType_t dataType, @@ -3657,6 +3658,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetPersistentRNNPlan(cudnnRNNDescripto return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNWorkspaceSize(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, @@ -3980,6 +3982,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnRNNBackwardWeights(cudnnHandle_t handl return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNPaddingMode(cudnnRNNDescriptor_t rnnDesc, cudnnRNNPaddingMode_t paddingMode){ CudnnFrontend::Prepare(); @@ -4007,6 +4010,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNPaddingMode(cudnnRNNDescriptor_t } return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreateRNNDataDescriptor(cudnnRNNDataDescriptor_t *rnnDataDesc){ @@ -4333,6 +4337,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnRNNBackwardWeightsEx(cudnnHandle_t han return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNAlgorithmDescriptor(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, cudnnAlgorithmDescriptor_t algoDesc){ CudnnFrontend::Prepare(); @@ -4346,6 +4351,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNAlgorithmDescriptor(cudnnHandle_ return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardInferenceAlgorithmMaxCount(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, int *count){ @@ -4361,6 +4367,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardInferenceAlgorithmMaxCoun return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardInferenceAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4418,6 +4425,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardInferenceAlgorithmEx(cud } return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardTrainingAlgorithmMaxCount(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, int *count){ @@ -4433,6 +4441,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardTrainingAlgorithmMaxCount return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardTrainingAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4493,6 +4502,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardTrainingAlgorithmEx(cudn } return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardDataAlgorithmMaxCount(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, int *count){ @@ -4509,7 +4519,8 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardDataAlgorithmMaxCount(cu } return CudnnFrontend::GetExitCode(); } - + +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardDataAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4582,6 +4593,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardDataAlgorithmEx(cudnnHa } return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardWeightsAlgorithmMaxCount(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, int *count){ @@ -4596,6 +4608,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardWeightsAlgorithmMaxCount return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardWeightsAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4647,6 +4660,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardWeightsAlgorithmEx(cudn } return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreateSeqDataDescriptor(cudnnSeqDataDescriptor_t *seqDataDesc){ @@ -5233,6 +5247,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetCTCLossWorkspaceSize(cudnnHandle_t return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9500 extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreateAlgorithmDescriptor(cudnnAlgorithmDescriptor_t *algoDesc){ CudnnFrontend::Prepare(); @@ -5408,6 +5423,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnRestoreAlgorithm(cudnnHandle_t handle, return CudnnFrontend::GetExitCode(); } +#endif extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetCallback(unsigned mask, void *udata, cudnnCallback_t fptr){ From 2ab261b82168f82b8f5b0afa25a7466238d59cd6 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 09:02:41 -0500 Subject: [PATCH 02/19] Texture/Shader refs removed in 11.3 --- plugins/cudart/CMakeLists.txt | 6 +++--- plugins/cudart/backend/CudaRtHandler.cpp | 8 ++++---- plugins/cudart/backend/CudaRtHandler.h | 8 ++++---- plugins/cudart/frontend/CudaRt_internal.cpp | 6 ++---- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/plugins/cudart/CMakeLists.txt b/plugins/cudart/CMakeLists.txt index 4e8ab979..17caaac2 100644 --- a/plugins/cudart/CMakeLists.txt +++ b/plugins/cudart/CMakeLists.txt @@ -30,7 +30,7 @@ string(REGEX REPLACE ".*\\.so\\.([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" CUDART_VERSION message(STATUS "Found cudaRt: ${CUDART_VERSION} (${CUDART_INCLUDE_DIRECTORY}/cuda_runtime_api.h, ${CUDART_LIBRARY})") -if (CUDART_VERSION LESS 12000) +if (CUDART_VERSION LESS 11030) gvirtus_add_backend(cudart ${CUDA_VERSION} backend/CudaRtHandler_texture.cpp @@ -68,7 +68,7 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -else (CUDART_VERSION LESS 12000) +else (CUDART_VERSION LESS 11030) gvirtus_add_backend(cudart ${CUDA_VERSION} # backend/CudaRtHandler_texture.cpp @@ -106,6 +106,6 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -endif (CUDART_VERSION LESS 12000) +endif (CUDART_VERSION LESS 11030) add_subdirectory(demo) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index b644f02e..f9aa02c8 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -59,7 +59,7 @@ CudaRtHandler::CudaRtHandler() { mpFatBinary = new map(); mpDeviceFunction = new map(); mpVar = new map(); -#if CUDART_VERSION < 12000 +#if CUDART_VERSION < 11030 mpTexture = new map(); mpSurface = new map(); #endif @@ -210,7 +210,7 @@ const char *CudaRtHandler::GetVar(const char *handler) { return GetVar(tmp); } -#if CUDART_VERSION < 12000 +#if CUDART_VERSION < 11030 void CudaRtHandler::RegisterTexture(string &handler, textureReference *texref) { mpTexture->insert(make_pair(handler, texref)); //#ifdef DEBUG @@ -372,7 +372,7 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSharedVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterShared)); -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterTexture)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSurface)); #endif @@ -424,7 +424,7 @@ void CudaRtHandler::Initialize() { #ifndef CUDART_VERSION #error CUDART_VERSION not defined #endif -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 /* CudaRtHandler_surface */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindSurfaceToArray)); diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index 4d16edd9..c384cb0f 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -111,7 +111,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { const char *GetVar(std::string &handler); const char *GetVar(const char *handler); -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 void RegisterTexture(std::string &handler, textureReference *texref); void RegisterTexture(const char *handler, textureReference *texref); void RegisterSurface(std::string &handler, surfaceReference *surref); @@ -172,7 +172,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { std::map *mpFatBinary; std::map *mpDeviceFunction; std::map *mpVar; -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 std::map *mpTexture; std::map *mpSurface; #endif @@ -248,7 +248,7 @@ CUDA_ROUTINE_HANDLER(RegisterFunction); CUDA_ROUTINE_HANDLER(RegisterVar); CUDA_ROUTINE_HANDLER(RegisterSharedVar); CUDA_ROUTINE_HANDLER(RegisterShared); -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 CUDA_ROUTINE_HANDLER(RegisterTexture); CUDA_ROUTINE_HANDLER(RegisterSurface); #endif @@ -298,7 +298,7 @@ CUDA_ROUTINE_HANDLER(StreamCreateWithFlags); CUDA_ROUTINE_HANDLER(StreamWaitEvent); CUDA_ROUTINE_HANDLER(StreamCreateWithPriority); -#if (CUDART_VERSION < 12000) +#if CUDART_VERSION < 11030 /* CudaRtHandler_texture */ CUDA_ROUTINE_HANDLER(BindTexture); CUDA_ROUTINE_HANDLER(BindTexture2D); diff --git a/plugins/cudart/frontend/CudaRt_internal.cpp b/plugins/cudart/frontend/CudaRt_internal.cpp index 35bcdd3d..616201d8 100644 --- a/plugins/cudart/frontend/CudaRt_internal.cpp +++ b/plugins/cudart/frontend/CudaRt_internal.cpp @@ -219,7 +219,7 @@ extern "C" __host__ void __cudaRegisterSharedVar(void **fatCubinHandle, CudaRtFrontend::Execute("cudaRegisterSharedVar"); } -#if 0 +#if CUDART_VERSION < 11030 extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, @@ -238,9 +238,7 @@ extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, CudaRtFrontend::AddVariableForArguments(ext); CudaRtFrontend::Execute("cudaRegisterTexture"); } -#endif -#if 0 extern "C" __host__ void __cudaRegisterSurface(void **fatCubinHandle, const surfaceReference *hostVar, void **deviceAddress, @@ -269,7 +267,7 @@ extern "C" __host__ int __cudaSynchronizeThreads(void **x, void *y) { return 0; } -#if 0 +#if CUDART_VERSION < 11030 extern "C" __host__ void __cudaTextureFetch(const void *tex, void *index, int integer, void *val) { // FIXME: implement From d70f4b6266347ff00a9412f3c0540e9690eabad3 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 09:43:15 -0500 Subject: [PATCH 03/19] Texture/Shader refs removed in 11.8 --- plugins/cudart/CMakeLists.txt | 6 +++--- plugins/cudart/backend/CudaRtHandler.cpp | 8 ++++---- plugins/cudart/backend/CudaRtHandler.h | 8 ++++---- plugins/cudart/frontend/CudaRt_internal.cpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/cudart/CMakeLists.txt b/plugins/cudart/CMakeLists.txt index 17caaac2..9369b58f 100644 --- a/plugins/cudart/CMakeLists.txt +++ b/plugins/cudart/CMakeLists.txt @@ -30,7 +30,7 @@ string(REGEX REPLACE ".*\\.so\\.([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" CUDART_VERSION message(STATUS "Found cudaRt: ${CUDART_VERSION} (${CUDART_INCLUDE_DIRECTORY}/cuda_runtime_api.h, ${CUDART_LIBRARY})") -if (CUDART_VERSION LESS 11030) +if (CUDART_VERSION LESS 11080) gvirtus_add_backend(cudart ${CUDA_VERSION} backend/CudaRtHandler_texture.cpp @@ -68,7 +68,7 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -else (CUDART_VERSION LESS 11030) +else (CUDART_VERSION LESS 11080) gvirtus_add_backend(cudart ${CUDA_VERSION} # backend/CudaRtHandler_texture.cpp @@ -106,6 +106,6 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -endif (CUDART_VERSION LESS 11030) +endif (CUDART_VERSION LESS 11080) add_subdirectory(demo) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index f9aa02c8..fd1de349 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -59,7 +59,7 @@ CudaRtHandler::CudaRtHandler() { mpFatBinary = new map(); mpDeviceFunction = new map(); mpVar = new map(); -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 mpTexture = new map(); mpSurface = new map(); #endif @@ -210,7 +210,7 @@ const char *CudaRtHandler::GetVar(const char *handler) { return GetVar(tmp); } -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 void CudaRtHandler::RegisterTexture(string &handler, textureReference *texref) { mpTexture->insert(make_pair(handler, texref)); //#ifdef DEBUG @@ -372,7 +372,7 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSharedVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterShared)); -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterTexture)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSurface)); #endif @@ -424,7 +424,7 @@ void CudaRtHandler::Initialize() { #ifndef CUDART_VERSION #error CUDART_VERSION not defined #endif -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 /* CudaRtHandler_surface */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindSurfaceToArray)); diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index c384cb0f..daaa3d50 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -111,7 +111,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { const char *GetVar(std::string &handler); const char *GetVar(const char *handler); -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 void RegisterTexture(std::string &handler, textureReference *texref); void RegisterTexture(const char *handler, textureReference *texref); void RegisterSurface(std::string &handler, surfaceReference *surref); @@ -172,7 +172,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { std::map *mpFatBinary; std::map *mpDeviceFunction; std::map *mpVar; -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 std::map *mpTexture; std::map *mpSurface; #endif @@ -248,7 +248,7 @@ CUDA_ROUTINE_HANDLER(RegisterFunction); CUDA_ROUTINE_HANDLER(RegisterVar); CUDA_ROUTINE_HANDLER(RegisterSharedVar); CUDA_ROUTINE_HANDLER(RegisterShared); -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 CUDA_ROUTINE_HANDLER(RegisterTexture); CUDA_ROUTINE_HANDLER(RegisterSurface); #endif @@ -298,7 +298,7 @@ CUDA_ROUTINE_HANDLER(StreamCreateWithFlags); CUDA_ROUTINE_HANDLER(StreamWaitEvent); CUDA_ROUTINE_HANDLER(StreamCreateWithPriority); -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 /* CudaRtHandler_texture */ CUDA_ROUTINE_HANDLER(BindTexture); CUDA_ROUTINE_HANDLER(BindTexture2D); diff --git a/plugins/cudart/frontend/CudaRt_internal.cpp b/plugins/cudart/frontend/CudaRt_internal.cpp index 616201d8..77819d0b 100644 --- a/plugins/cudart/frontend/CudaRt_internal.cpp +++ b/plugins/cudart/frontend/CudaRt_internal.cpp @@ -219,7 +219,7 @@ extern "C" __host__ void __cudaRegisterSharedVar(void **fatCubinHandle, CudaRtFrontend::Execute("cudaRegisterSharedVar"); } -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, @@ -267,7 +267,7 @@ extern "C" __host__ int __cudaSynchronizeThreads(void **x, void *y) { return 0; } -#if CUDART_VERSION < 11030 +#if CUDART_VERSION < 11080 extern "C" __host__ void __cudaTextureFetch(const void *tex, void *index, int integer, void *val) { // FIXME: implement From 0f5e5883fecbe6f431cdbfed9ac1c4e07287fa57 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 09:46:12 -0500 Subject: [PATCH 04/19] Texture/Shader refs removed in 11.8 --- plugins/cudart/backend/CudaRtHandler_internal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 5afad63a..0837d2d3 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -81,7 +81,7 @@ extern void __cudaRegisterVar(void **fatCubinHandle, char *hostVar, extern void __cudaRegisterSharedVar(void **fatCubinHandle, void **devicePtr, size_t size, size_t alignment, int storage); extern void __cudaRegisterShared(void **fatCubinHandle, void **devicePtr); -#if CUDART_VERSION < 12000 +#if CUDART_VERSION < 11080 extern void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, char *deviceName, @@ -99,7 +99,7 @@ static size_t constStrings_size = 0; static size_t constStrings_length = 0; // static void ** fatCubinHandlers[2048]; // static void * fatCubins[2048]; -#if CUDART_VERSION < 12000 +#if CUDART_VERSION < 11080 static const textureReference * texrefHandlers[2048]; static const textureReference * texref[2048]; #endif @@ -425,7 +425,7 @@ CUDA_ROUTINE_HANDLER(RegisterShared) { return std::make_shared(cudaSuccess); } -#if CUDART_VERSION < 12000 +#if CUDART_VERSION < 11080 CUDA_ROUTINE_HANDLER(RegisterTexture) { try { char *handler = input_buffer->AssignString(); From ee0b32ef419cce330ab76aa51420fdbf199bf362 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 09:47:33 -0500 Subject: [PATCH 05/19] Texture/Shader refs removed in 11.8 --- plugins/cudart/backend/CudaRtHandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index daaa3d50..d25a2ca0 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -59,7 +59,7 @@ #include "../3rdparty/include/CudaRt_internal.h" -#if (CUDART_VERSION < 12000) +#if (CUDART_VERSION < 11080) #if (CUDART_VERSION >= 9020) #if (CUDART_VERSION >= 11000) #define __CUDACC__ From aba9344b7d9b941c6155b3e1e747576363db79b2 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:03:33 -0500 Subject: [PATCH 06/19] Note deprecation versions --- plugins/cublas/backend/CublasHandler.h | 3 ++- plugins/cublas/frontend/CublasFrontend.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/cublas/backend/CublasHandler.h b/plugins/cublas/backend/CublasHandler.h index e3784901..bf6cc3fa 100644 --- a/plugins/cublas/backend/CublasHandler.h +++ b/plugins/cublas/backend/CublasHandler.h @@ -40,7 +40,8 @@ #include #include -//#include +// Deprecated to include both in 2.1.15.cuBLAS: Release 12.0 +// #include #include "cublas_v2.h" #include diff --git a/plugins/cublas/frontend/CublasFrontend.h b/plugins/cublas/frontend/CublasFrontend.h index 3bbbf2e9..2efe69e2 100644 --- a/plugins/cublas/frontend/CublasFrontend.h +++ b/plugins/cublas/frontend/CublasFrontend.h @@ -25,6 +25,7 @@ #ifndef CUBLASFRONTEND_H #define CUBLASFRONTEND_H +// Deprecated to include both in 2.1.15.cuBLAS: Release 12.0 // #include // #include #include "cublas_v2.h" From 05713df40a78ee3f57f69772b845bc472f863027 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:05:40 -0500 Subject: [PATCH 07/19] Restore mspHandlers --- plugins/cudart/backend/CudaRtHandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index fd1de349..f8698dbc 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -434,9 +434,9 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindTextureToArray)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(CreateTextureObject)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetChannelDesc)); - // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureAlignmentOffset)); - // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureReference)); - // mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(UnbindTexture)); + mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureAlignmentOffset)); + mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(GetTextureReference)); + mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(UnbindTexture)); #endif /* CudaRtHandler_thread */ From d24436e1598e1b306d327baf3bfba0eaa323d6dd Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:08:40 -0500 Subject: [PATCH 08/19] Revert --- plugins/cudart/backend/CudaRtHandler_internal.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 0837d2d3..fbed61d5 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -99,10 +99,8 @@ static size_t constStrings_size = 0; static size_t constStrings_length = 0; // static void ** fatCubinHandlers[2048]; // static void * fatCubins[2048]; -#if CUDART_VERSION < 11080 -static const textureReference * texrefHandlers[2048]; -static const textureReference * texref[2048]; -#endif +// static const textureReference * texrefHandlers[2048]; +// static const textureReference * texref[2048]; static void init() { // constStrings_size = 2048; From 574804220f6bbbb8e3931f0cb33fb8b536ad73c3 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:11:24 -0500 Subject: [PATCH 09/19] Debug --- plugins/cudart/backend/CudaRtHandler_internal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index fbed61d5..9f0bd99a 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -448,12 +448,12 @@ CUDA_ROUTINE_HANDLER(RegisterTexture) { cerr << "error executing RegisterTexture: " << _cudaGetErrorEnum(error) << endl; } +#endif } catch (string e) { cerr << e << endl; return std::make_shared(cudaErrorMemoryAllocation); } -#endif #if 0 try { From 7bab1ec72a1bba70ed22761b1638784b768b35c6 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:46:56 -0500 Subject: [PATCH 10/19] Don't guess at implementation --- .../cudart/backend/CudaRtHandler_internal.cpp | 1 + plugins/cudnn/backend/CudnnHandler.cpp | 67 +------------------ 2 files changed, 2 insertions(+), 66 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 9f0bd99a..807fd1a7 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -509,6 +509,7 @@ CUDA_ROUTINE_HANDLER(RegisterSurface) { #if (CUDART_VERSION >= 9020) + #if (CUDART_VERSION >= 11000) #define __CUDACC__ #define cudaPushCallConfiguration __cudaPushCallConfiguration diff --git a/plugins/cudnn/backend/CudnnHandler.cpp b/plugins/cudnn/backend/CudnnHandler.cpp index ddbeeb75..463b4254 100644 --- a/plugins/cudnn/backend/CudnnHandler.cpp +++ b/plugins/cudnn/backend/CudnnHandler.cpp @@ -4028,73 +4028,8 @@ CUDNN_ROUTINE_HANDLER(DestroyRNNDescriptor){ } #endif -#if CUDNN_VERSION >= 9500 +#if CUDNN_VERSION >= 9000 // TODO: implement -#elif CUDNN_VERSION >= 9000 -CUDNN_ROUTINE_HANDLER(SetRNNDescriptor){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNDescriptor")); - - cudnnHandle_t handle = (cudnnHandle_t)in->Get(); - cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); - int hiddenSize = in->Get(); - int numLayers = in->Get(); - cudnnDropoutDescriptor_t dropoutDesc = (cudnnDropoutDescriptor_t)in->Get(); - cudnnRNNInputMode_t inputMode = in->Get(); - cudnnDirectionMode_t direction = in->Get(); - cudnnRNNMode_t mode = in->Get(); - cudnnRNNAlgo_t algo = in->Get(); - cudnnDataType_t mathPrec = in->Get(); - - cudnnStatus_t cs = cudnnSetRNNDescriptor(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, mathPrec); - - std::shared_ptr out = std::make_shared(); - try{ - out->Add(rnnDesc); - } catch(string e){ - LOG4CPLUS_DEBUG(logger, e); - return std::make_shared(cs); - } - - LOG4CPLUS_DEBUG(logger, "cudnnSetRNNDescriptor Executed"); - //cout << " DEBUG - cudnnSetRNNDescriptor Executed"<(cs, out); -} - -CUDNN_ROUTINE_HANDLER(GetRNNDescriptor){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNDescriptor")); - - cudnnHandle_t handle = (cudnnHandle_t)in->Get(); - cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); - int hiddenSize; - int numLayers; - cudnnDropoutDescriptor_t dropoutDesc; - cudnnRNNInputMode_t inputMode; - cudnnDirectionMode_t direction; - cudnnRNNMode_t mode; - cudnnRNNAlgo_t algo; - cudnnDataType_t mathPrec; - - cudnnStatus_t cs = cudnnGetRNNDescriptor(handle, rnnDesc, &hiddenSize, &numLayers, &dropoutDesc, &inputMode, &direction, &mode, &algo, &mathPrec); - - std::shared_ptr out = std::make_shared(); - try{ - out->Add(hiddenSize); - out->Add(numLayers); - out->Add(dropoutDesc); - out->Add(inputMode); - out->Add(direction); - out->Add(mode); - out->Add(algo); - out->Add(mathPrec); - } catch(string e){ - LOG4CPLUS_DEBUG(logger, e); - return std::make_shared(cs); - } - - LOG4CPLUS_DEBUG(logger, "cudnnGetRNNDescriptor Executed"); - //cout << " DEBUG - cudnnGetRNNDescriptor Executed"<(cs, out); -} #elif (CUDNN_VERSION >= 6000) CUDNN_ROUTINE_HANDLER(SetRNNDescriptor_v6){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNDescriptor_v6")); From 277e3e9b44473dcf22d2a8bf72189b2abde898a4 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:56:23 -0500 Subject: [PATCH 11/19] Revert cudnn --- plugins/cudnn/backend/CudnnHandler.cpp | 49 ++------------------------ plugins/cudnn/frontend/Cudnn.cpp | 16 ++++----- 2 files changed, 11 insertions(+), 54 deletions(-) diff --git a/plugins/cudnn/backend/CudnnHandler.cpp b/plugins/cudnn/backend/CudnnHandler.cpp index 463b4254..5629d3ed 100644 --- a/plugins/cudnn/backend/CudnnHandler.cpp +++ b/plugins/cudnn/backend/CudnnHandler.cpp @@ -4201,7 +4201,7 @@ CUDNN_ROUTINE_HANDLER(GetRNNDescriptor_v8) { } #endif -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 CUDNN_ROUTINE_HANDLER(SetRNNMatrixMathType){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("SetRNNMatrixMathType")); @@ -4304,7 +4304,6 @@ CUDNN_ROUTINE_HANDLER(RNNSetClip){ return std::make_shared(cs, out); } - CUDNN_ROUTINE_HANDLER(RNNGetClip){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNGetClip")); @@ -4760,48 +4759,6 @@ CUDNN_ROUTINE_HANDLER(GetRNNPaddingMode){ //cout << " DEBUG - cudnnGetRNNPaddingMode Executed"<(cs, out); } -#else -CUDNN_ROUTINE_HANDLER(GetRNNLinLayerBiasParams){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); - - cudnnHandle_t handle = (cudnnHandle_t)in->Get(); - cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); - int pseudoLayer = in->Get(); - size_t weightSpaceSize = (size_t)in->Get(); - void *weights = in->Assign(); - int linLayerID = in->Get(); - cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); - void *x; - cudnnTensorDescriptor_t wDesc = (cudnnTensorDescriptor_t)in->Get(); - void *w; - - cudnnStatus_t cs = cudnnGetRNNWeightParams(handle, rnnDesc, pseudoLayer, weightSpaceSize, weights, linLayerID, xDesc, &x, wDesc, &w); - - std::shared_ptr out = std::make_shared(); - try { - out->Add(x); - out->Add(w); - } catch (string e){ - LOG4CPLUS_DEBUG(logger, e); - return std::make_shared(cs); - } - - LOG4CPLUS_DEBUG(logger, "cudnnGetRNNLinLayerBiasParams Executed"); - //cout << " DEBUG - cudnnGetRNNLinLayerBiasParams Executed"<(cs, out); -} - -CUDNN_ROUTINE_HANDLER(RNNForward){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNForward")); - LOG4CPLUS_DEBUG(logger, " cudnnRNNForward not implemented"); - throw std::logic_error("cudnnRNNForward not implemented"); -} - -CUDNN_ROUTINE_HANDLER(RNNBackward){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNBackward")); - LOG4CPLUS_DEBUG(logger, " cudnnRNNBackward not implemented"); - throw std::logic_error("cudnnRNNBackward not implemented"); -} #endif CUDNN_ROUTINE_HANDLER(CreateRNNDataDescriptor){ @@ -4899,7 +4856,7 @@ CUDNN_ROUTINE_HANDLER(GetRNNDataDescriptor){ return std::make_shared(cs, out); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 CUDNN_ROUTINE_HANDLER(RNNForwardTrainingEx){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("RNNForwardTrainingEx")); @@ -5972,7 +5929,7 @@ CUDNN_ROUTINE_HANDLER(GetCTCLossWorkspaceSize){ return std::make_shared(cs, out); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 CUDNN_ROUTINE_HANDLER(CreateAlgorithmDescriptor){ Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("CreateAlgorithmDescriptor")); diff --git a/plugins/cudnn/frontend/Cudnn.cpp b/plugins/cudnn/frontend/Cudnn.cpp index 5a512025..d1567a14 100644 --- a/plugins/cudnn/frontend/Cudnn.cpp +++ b/plugins/cudnn/frontend/Cudnn.cpp @@ -3616,7 +3616,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNProjectionLayers(cudnnHandle_t h return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreatePersistentRNNPlan(cudnnRNNDescriptor_t rnnDesc, const int minibatch, const cudnnDataType_t dataType, @@ -3982,7 +3982,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnRNNBackwardWeights(cudnnHandle_t handl return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNPaddingMode(cudnnRNNDescriptor_t rnnDesc, cudnnRNNPaddingMode_t paddingMode){ CudnnFrontend::Prepare(); @@ -4337,7 +4337,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnRNNBackwardWeightsEx(cudnnHandle_t han return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNAlgorithmDescriptor(cudnnHandle_t handle, cudnnRNNDescriptor_t rnnDesc, cudnnAlgorithmDescriptor_t algoDesc){ CudnnFrontend::Prepare(); @@ -4367,7 +4367,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardInferenceAlgorithmMaxCoun return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardInferenceAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4441,7 +4441,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNForwardTrainingAlgorithmMaxCount return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNForwardTrainingAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4520,7 +4520,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardDataAlgorithmMaxCount(cu return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardDataAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -4608,7 +4608,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNBackwardWeightsAlgorithmMaxCount return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnFindRNNBackwardWeightsAlgorithmEx(cudnnHandle_t handle, const cudnnRNNDescriptor_t rnnDesc, const int seqLength, @@ -5247,7 +5247,7 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetCTCLossWorkspaceSize(cudnnHandle_t return CudnnFrontend::GetExitCode(); } -#if CUDNN_VERSION < 9500 +#if CUDNN_VERSION < 9000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreateAlgorithmDescriptor(cudnnAlgorithmDescriptor_t *algoDesc){ CudnnFrontend::Prepare(); From 3f5d3e2c5ff921ba7a985fd400c49b342a5da1d8 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 10:58:20 -0500 Subject: [PATCH 12/19] Revert formatting --- plugins/cudnn/backend/CudnnHandler.cpp | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/cudnn/backend/CudnnHandler.cpp b/plugins/cudnn/backend/CudnnHandler.cpp index 5629d3ed..337c7912 100644 --- a/plugins/cudnn/backend/CudnnHandler.cpp +++ b/plugins/cudnn/backend/CudnnHandler.cpp @@ -4525,27 +4525,27 @@ CUDNN_ROUTINE_HANDLER(GetRNNLinLayerMatrixParams){ } CUDNN_ROUTINE_HANDLER(GetRNNLinLayerBiasParams){ - Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); + Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("GetRNNLinLayerBiasParams")); - cudnnHandle_t handle = (cudnnHandle_t)in->Get(); - cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); - int pseudoLayer = in->Get(); - cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); - cudnnFilterDescriptor_t wDesc = (cudnnFilterDescriptor_t)in->Get(); - void *w = in->Assign(); - int linLayerID = in->Get(); - cudnnFilterDescriptor_t linLayerBiasDesc; - void *linLayerBias; + cudnnHandle_t handle = (cudnnHandle_t)in->Get(); + cudnnRNNDescriptor_t rnnDesc = (cudnnRNNDescriptor_t)in->Get(); + int pseudoLayer = in->Get(); + cudnnTensorDescriptor_t xDesc = (cudnnTensorDescriptor_t)in->Get(); + cudnnFilterDescriptor_t wDesc = (cudnnFilterDescriptor_t)in->Get(); + void *w = in->Assign(); + int linLayerID = in->Get(); + cudnnFilterDescriptor_t linLayerBiasDesc; + void *linLayerBias; - cudnnStatus_t cs = cudnnGetRNNLinLayerBiasParams(handle, rnnDesc, pseudoLayer, xDesc, wDesc, w, linLayerID, linLayerBiasDesc, &linLayerBias); + cudnnStatus_t cs = cudnnGetRNNLinLayerBiasParams(handle, rnnDesc, pseudoLayer, xDesc, wDesc, w, linLayerID, linLayerBiasDesc, &linLayerBias); - std::shared_ptr out = std::make_shared(); - try { - out->Add(linLayerBiasDesc); - out->Add(linLayerBias); - } catch (string e){ - LOG4CPLUS_DEBUG(logger, e); - return std::make_shared(cs); + std::shared_ptr out = std::make_shared(); + try{ + out->Add(linLayerBiasDesc); + out->Add(linLayerBias); + } catch(string e){ + LOG4CPLUS_DEBUG(logger, e); + return std::make_shared(cs); } LOG4CPLUS_DEBUG(logger, "cudnnGetRNNLinLayerBiasParams Executed"); From 011604470315afa468dfdc3f6625d81350140c5a Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 24 Nov 2024 11:19:38 -0500 Subject: [PATCH 13/19] crt/device_functions.h if CUDART_VERSION < 11080 --- plugins/cudart/backend/CudaRtHandler_internal.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 807fd1a7..38c79cab 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -516,7 +516,9 @@ CUDA_ROUTINE_HANDLER(RegisterSurface) { #endif -// #include "crt/device_functions.h" +#if CUDART_VERSION < 11080 +#include "crt/device_functions.h" +#endif #include "CudaRt_internal.h" CUDA_ROUTINE_HANDLER(PushCallConfiguration) { From 3a8d1e27b8cba597e80d44d7b8c44dc78975ed81 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Mon, 25 Nov 2024 08:57:08 -0500 Subject: [PATCH 14/19] Texture references dropped in 12000 --- plugins/cudart/CMakeLists.txt | 6 +++--- plugins/cudart/backend/CudaRtHandler.cpp | 8 ++++---- plugins/cudart/backend/CudaRtHandler.h | 10 +++++----- plugins/cudart/backend/CudaRtHandler_internal.cpp | 6 +++--- plugins/cudart/frontend/CudaRt_internal.cpp | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/cudart/CMakeLists.txt b/plugins/cudart/CMakeLists.txt index 9369b58f..4e8ab979 100644 --- a/plugins/cudart/CMakeLists.txt +++ b/plugins/cudart/CMakeLists.txt @@ -30,7 +30,7 @@ string(REGEX REPLACE ".*\\.so\\.([0-9]+\\.[0-9]+\\.[0-9]+)" "\\1" CUDART_VERSION message(STATUS "Found cudaRt: ${CUDART_VERSION} (${CUDART_INCLUDE_DIRECTORY}/cuda_runtime_api.h, ${CUDART_LIBRARY})") -if (CUDART_VERSION LESS 11080) +if (CUDART_VERSION LESS 12000) gvirtus_add_backend(cudart ${CUDA_VERSION} backend/CudaRtHandler_texture.cpp @@ -68,7 +68,7 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -else (CUDART_VERSION LESS 11080) +else (CUDART_VERSION LESS 12000) gvirtus_add_backend(cudart ${CUDA_VERSION} # backend/CudaRtHandler_texture.cpp @@ -106,6 +106,6 @@ gvirtus_add_frontend(cudart ${CUDA_VERSION} frontend/CudaRt_version.cpp util/CudaUtil.cpp) -endif (CUDART_VERSION LESS 11080) +endif (CUDART_VERSION LESS 12000) add_subdirectory(demo) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index f8698dbc..8b2bba3a 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -59,7 +59,7 @@ CudaRtHandler::CudaRtHandler() { mpFatBinary = new map(); mpDeviceFunction = new map(); mpVar = new map(); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 mpTexture = new map(); mpSurface = new map(); #endif @@ -210,7 +210,7 @@ const char *CudaRtHandler::GetVar(const char *handler) { return GetVar(tmp); } -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 void CudaRtHandler::RegisterTexture(string &handler, textureReference *texref) { mpTexture->insert(make_pair(handler, texref)); //#ifdef DEBUG @@ -372,7 +372,7 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSharedVar)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterShared)); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterTexture)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(RegisterSurface)); #endif @@ -424,7 +424,7 @@ void CudaRtHandler::Initialize() { #ifndef CUDART_VERSION #error CUDART_VERSION not defined #endif -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 /* CudaRtHandler_surface */ mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(BindSurfaceToArray)); diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index d25a2ca0..78e6a1f0 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -59,7 +59,7 @@ #include "../3rdparty/include/CudaRt_internal.h" -#if (CUDART_VERSION < 11080) +#if (CUDART_VERSION < 12000) #if (CUDART_VERSION >= 9020) #if (CUDART_VERSION >= 11000) #define __CUDACC__ @@ -111,7 +111,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { const char *GetVar(std::string &handler); const char *GetVar(const char *handler); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 void RegisterTexture(std::string &handler, textureReference *texref); void RegisterTexture(const char *handler, textureReference *texref); void RegisterSurface(std::string &handler, surfaceReference *surref); @@ -172,7 +172,7 @@ class CudaRtHandler : public gvirtus::backend::Handler { std::map *mpFatBinary; std::map *mpDeviceFunction; std::map *mpVar; -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 std::map *mpTexture; std::map *mpSurface; #endif @@ -248,7 +248,7 @@ CUDA_ROUTINE_HANDLER(RegisterFunction); CUDA_ROUTINE_HANDLER(RegisterVar); CUDA_ROUTINE_HANDLER(RegisterSharedVar); CUDA_ROUTINE_HANDLER(RegisterShared); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 CUDA_ROUTINE_HANDLER(RegisterTexture); CUDA_ROUTINE_HANDLER(RegisterSurface); #endif @@ -298,7 +298,7 @@ CUDA_ROUTINE_HANDLER(StreamCreateWithFlags); CUDA_ROUTINE_HANDLER(StreamWaitEvent); CUDA_ROUTINE_HANDLER(StreamCreateWithPriority); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 /* CudaRtHandler_texture */ CUDA_ROUTINE_HANDLER(BindTexture); CUDA_ROUTINE_HANDLER(BindTexture2D); diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index 38c79cab..c29e26c3 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -81,7 +81,7 @@ extern void __cudaRegisterVar(void **fatCubinHandle, char *hostVar, extern void __cudaRegisterSharedVar(void **fatCubinHandle, void **devicePtr, size_t size, size_t alignment, int storage); extern void __cudaRegisterShared(void **fatCubinHandle, void **devicePtr); -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 extern void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, char *deviceName, @@ -423,7 +423,7 @@ CUDA_ROUTINE_HANDLER(RegisterShared) { return std::make_shared(cudaSuccess); } -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 CUDA_ROUTINE_HANDLER(RegisterTexture) { try { char *handler = input_buffer->AssignString(); @@ -516,7 +516,7 @@ CUDA_ROUTINE_HANDLER(RegisterSurface) { #endif -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 #include "crt/device_functions.h" #endif #include "CudaRt_internal.h" diff --git a/plugins/cudart/frontend/CudaRt_internal.cpp b/plugins/cudart/frontend/CudaRt_internal.cpp index 77819d0b..c1891e01 100644 --- a/plugins/cudart/frontend/CudaRt_internal.cpp +++ b/plugins/cudart/frontend/CudaRt_internal.cpp @@ -219,7 +219,7 @@ extern "C" __host__ void __cudaRegisterSharedVar(void **fatCubinHandle, CudaRtFrontend::Execute("cudaRegisterSharedVar"); } -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 extern "C" __host__ void __cudaRegisterTexture(void **fatCubinHandle, const textureReference *hostVar, void **deviceAddress, @@ -267,7 +267,7 @@ extern "C" __host__ int __cudaSynchronizeThreads(void **x, void *y) { return 0; } -#if CUDART_VERSION < 11080 +#if CUDART_VERSION < 12000 extern "C" __host__ void __cudaTextureFetch(const void *tex, void *index, int integer, void *val) { // FIXME: implement From 2f9a5b9a2804d4e068b5e1ebe93afaa06a54dd92 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Mon, 25 Nov 2024 09:34:17 -0500 Subject: [PATCH 15/19] Fix warning --- plugins/cudart/backend/CudaRtHandler_device.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/cudart/backend/CudaRtHandler_device.cpp b/plugins/cudart/backend/CudaRtHandler_device.cpp index 566c365a..0a62fdcd 100644 --- a/plugins/cudart/backend/CudaRtHandler_device.cpp +++ b/plugins/cudart/backend/CudaRtHandler_device.cpp @@ -364,7 +364,10 @@ CUDA_ROUTINE_HANDLER(IpcOpenEventHandle) { cudaEvent_t *event = input_buffer->Assign(); cudaIpcEventHandle_t handle = input_buffer->Get(); cudaError_t exit_code = cudaIpcOpenEventHandle(event, handle); + out->Add(event); + return std::make_shared(exit_code, out); + } catch (string e) { // cerr << e << endl; LOG4CPLUS_DEBUG(logger, e); From 3878c42dba734ff9149064ffbe5deb2e2474c184 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Mon, 25 Nov 2024 09:36:06 -0500 Subject: [PATCH 16/19] Fix warning --- plugins/cudart/backend/CudaRtHandler_device.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler_device.cpp b/plugins/cudart/backend/CudaRtHandler_device.cpp index 0a62fdcd..489a8cce 100644 --- a/plugins/cudart/backend/CudaRtHandler_device.cpp +++ b/plugins/cudart/backend/CudaRtHandler_device.cpp @@ -358,12 +358,11 @@ CUDA_ROUTINE_HANDLER(IpcOpenEventHandle) { Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("IpcOpenEventHandler")); CudaRtHandler::setLogLevel(&logger); - std::shared_ptr out = std::make_shared(); - try { cudaEvent_t *event = input_buffer->Assign(); cudaIpcEventHandle_t handle = input_buffer->Get(); cudaError_t exit_code = cudaIpcOpenEventHandle(event, handle); + std::shared_ptr out = std::make_shared(); out->Add(event); return std::make_shared(exit_code, out); From 173b8df621ed657faa23df8baacd347bd2dfe034 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 1 Dec 2024 06:03:46 -0500 Subject: [PATCH 17/19] Restore macro --- plugins/cudart/backend/CudaRtHandler.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index 78e6a1f0..54b3d30e 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -59,14 +59,17 @@ #include "../3rdparty/include/CudaRt_internal.h" -#if (CUDART_VERSION < 12000) #if (CUDART_VERSION >= 9020) + #if (CUDART_VERSION >= 11000) #define __CUDACC__ #define cudaPushCallConfiguration __cudaPushCallConfiguration #endif + +#if (CUDART_VERSION < 12000) #include "crt/device_functions.h" #endif + #endif //#define DEBUG From fe4d2485f663fde1633f9f898260c71a91d729d5 Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 1 Dec 2024 06:23:52 -0500 Subject: [PATCH 18/19] No PushCallConfiguration --- plugins/cudart/backend/CudaRtHandler.cpp | 2 +- plugins/cudart/backend/CudaRtHandler.h | 2 +- plugins/cudart/backend/CudaRtHandler_internal.cpp | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/cudart/backend/CudaRtHandler.cpp b/plugins/cudart/backend/CudaRtHandler.cpp index 8b2bba3a..e76ff83c 100644 --- a/plugins/cudart/backend/CudaRtHandler.cpp +++ b/plugins/cudart/backend/CudaRtHandler.cpp @@ -358,7 +358,7 @@ void CudaRtHandler::Initialize() { mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(SetDoubleForDevice)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(SetDoubleForHost)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(SetupArgument)); -#if CUDART_VERSION >= 9020 +#if (CUDART_VERSION >= 9020) && (CUDART_VERSION < 12000) mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(PushCallConfiguration)); mspHandlers->insert(CUDA_ROUTINE_HANDLER_PAIR(PopCallConfiguration)); #endif diff --git a/plugins/cudart/backend/CudaRtHandler.h b/plugins/cudart/backend/CudaRtHandler.h index 54b3d30e..d8e4bdb3 100644 --- a/plugins/cudart/backend/CudaRtHandler.h +++ b/plugins/cudart/backend/CudaRtHandler.h @@ -238,7 +238,7 @@ CUDA_ROUTINE_HANDLER(SetDoubleForDevice); CUDA_ROUTINE_HANDLER(SetDoubleForHost); CUDA_ROUTINE_HANDLER(SetupArgument); -#if CUDART_VERSION >= 9020 +#if (CUDART_VERSION >= 9020) && (CUDART_VERSION < 12000) CUDA_ROUTINE_HANDLER(PushCallConfiguration); CUDA_ROUTINE_HANDLER(PopCallConfiguration); #endif diff --git a/plugins/cudart/backend/CudaRtHandler_internal.cpp b/plugins/cudart/backend/CudaRtHandler_internal.cpp index c29e26c3..982e510d 100644 --- a/plugins/cudart/backend/CudaRtHandler_internal.cpp +++ b/plugins/cudart/backend/CudaRtHandler_internal.cpp @@ -507,18 +507,14 @@ CUDA_ROUTINE_HANDLER(RegisterSurface) { return std::make_shared(cudaSuccess); } -#if (CUDART_VERSION >= 9020) - +#if (CUDART_VERSION >= 9020) && (CUDART_VERSION < 12000) #if (CUDART_VERSION >= 11000) #define __CUDACC__ #define cudaPushCallConfiguration __cudaPushCallConfiguration #endif - -#if CUDART_VERSION < 12000 #include "crt/device_functions.h" -#endif #include "CudaRt_internal.h" CUDA_ROUTINE_HANDLER(PushCallConfiguration) { From f8f7b9af0adffc15dc06db440c85d9c2aa3271ca Mon Sep 17 00:00:00 2001 From: WrathfulSpatula Date: Sun, 1 Dec 2024 06:48:41 -0500 Subject: [PATCH 19/19] Cut unimplemented methods from front end --- plugins/cudart/frontend/CudaRt_internal.cpp | 2 +- plugins/cudnn/backend/CudnnHandler.cpp | 2 ++ plugins/cudnn/backend/CudnnHandler.h | 2 ++ plugins/cudnn/frontend/Cudnn.cpp | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/cudart/frontend/CudaRt_internal.cpp b/plugins/cudart/frontend/CudaRt_internal.cpp index c1891e01..5b662c6a 100644 --- a/plugins/cudart/frontend/CudaRt_internal.cpp +++ b/plugins/cudart/frontend/CudaRt_internal.cpp @@ -274,7 +274,6 @@ extern "C" __host__ void __cudaTextureFetch(const void *tex, void *index, std::cerr << "*** Error: __cudaTextureFetch() not yet implemented!" << std::endl; } -#endif #if CUDA_VERSION >= 9000 extern "C" __host__ __device__ unsigned CUDARTAPI __cudaPushCallConfiguration(dim3 gridDim, dim3 blockDim, size_t sharedMem = 0, void *stream = 0) { @@ -334,3 +333,4 @@ extern "C" cudaError_t CUDARTAPI __cudaPopCallConfiguration( dim3 *gridDim, return cudaError; } #endif +#endif diff --git a/plugins/cudnn/backend/CudnnHandler.cpp b/plugins/cudnn/backend/CudnnHandler.cpp index 337c7912..015d7697 100644 --- a/plugins/cudnn/backend/CudnnHandler.cpp +++ b/plugins/cudnn/backend/CudnnHandler.cpp @@ -250,6 +250,7 @@ void CudnnHandler::Initialize(){ mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(DropoutBackward)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(CreateRNNDescriptor)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(DestroyRNNDescriptor)); +#if CUDNN_VERSION < 9000 #if CUDNN_VERSION < 8000 mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(SetRNNDescriptor_v5)); //mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(GetRNNDescriptor_v5)); @@ -285,6 +286,7 @@ void CudnnHandler::Initialize(){ mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(RNNBackwardWeights)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(SetRNNPaddingMode)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(GetRNNPaddingMode)); +#endif mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(CreateRNNDataDescriptor)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(DestroyRNNDataDescriptor)); mspHandlers->insert(CUDNN_ROUTINE_HANDLER_PAIR(SetRNNDataDescriptor)); diff --git a/plugins/cudnn/backend/CudnnHandler.h b/plugins/cudnn/backend/CudnnHandler.h index ab43a5c7..7a5b05c2 100644 --- a/plugins/cudnn/backend/CudnnHandler.h +++ b/plugins/cudnn/backend/CudnnHandler.h @@ -333,6 +333,7 @@ CUDNN_ROUTINE_HANDLER(DestroyRNNDescriptor); CUDNN_ROUTINE_HANDLER(SetRNNDescriptor_v5); //CUDNN_ROUTINE_HANDLER(GetRNNDescriptor_v5); #endif +#if CUDNN_VERSION < 9000 #if CUDNN_VERSION >= 6000 CUDNN_ROUTINE_HANDLER(SetRNNDescriptor_v6); CUDNN_ROUTINE_HANDLER(GetRNNDescriptor_v6); @@ -363,6 +364,7 @@ CUDNN_ROUTINE_HANDLER(RNNBackwardData); CUDNN_ROUTINE_HANDLER(RNNBackwardWeights); CUDNN_ROUTINE_HANDLER(SetRNNPaddingMode); CUDNN_ROUTINE_HANDLER(GetRNNPaddingMode); +#endif CUDNN_ROUTINE_HANDLER(CreateRNNDataDescriptor); CUDNN_ROUTINE_HANDLER(DestroyRNNDataDescriptor); CUDNN_ROUTINE_HANDLER(SetRNNDataDescriptor); diff --git a/plugins/cudnn/frontend/Cudnn.cpp b/plugins/cudnn/frontend/Cudnn.cpp index d1567a14..4f244f5e 100644 --- a/plugins/cudnn/frontend/Cudnn.cpp +++ b/plugins/cudnn/frontend/Cudnn.cpp @@ -3301,6 +3301,8 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnDestroyRNNDescriptor(cudnnRNNDescripto return CudnnFrontend::GetExitCode(); } +#if CUDNN_VERSION < 9000 + #if CUDNN_VERSION < 8000 extern "C" cudnnStatus_t CUDNNWINAPI cudnnSetRNNDescriptor_v5(cudnnRNNDescriptor_t rnnDesc, int hiddenSize, @@ -4012,6 +4014,8 @@ extern "C" cudnnStatus_t CUDNNWINAPI cudnnGetRNNPaddingMode(cudnnRNNDescriptor_t } #endif +#endif + extern "C" cudnnStatus_t CUDNNWINAPI cudnnCreateRNNDataDescriptor(cudnnRNNDataDescriptor_t *rnnDataDesc){ CudnnFrontend::Prepare();