From 5208231126a290fdddbed0714d6a23f3db46dd64 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Fri, 23 Apr 2021 14:56:20 -0700 Subject: [PATCH] Fix some warnings in our CUDA code (#7436) --- onnxruntime/core/providers/cuda/cuda_allocator.h | 2 +- onnxruntime/core/providers/cuda/cuda_call.cc | 2 +- onnxruntime/core/providers/cuda/cuda_common.h | 3 +-- .../core/providers/cuda/cuda_execution_provider_info.h | 4 ++-- onnxruntime/core/providers/cuda/cudnn_common.cc | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/onnxruntime/core/providers/cuda/cuda_allocator.h b/onnxruntime/core/providers/cuda/cuda_allocator.h index 097662e9d5..0dd6d1e300 100644 --- a/onnxruntime/core/providers/cuda/cuda_allocator.h +++ b/onnxruntime/core/providers/cuda/cuda_allocator.h @@ -28,7 +28,7 @@ class CUDAExternalAllocator : public CUDAAllocator { typedef void (*ExternalFree)(void* p); public: - CUDAExternalAllocator(OrtDevice::DeviceId device_id, const char* name, const void* alloc, const void* free) + CUDAExternalAllocator(OrtDevice::DeviceId device_id, const char* name, void* alloc, void* free) : CUDAAllocator(device_id, name) { alloc_ = reinterpret_cast(alloc); free_ = reinterpret_cast(free); diff --git a/onnxruntime/core/providers/cuda/cuda_call.cc b/onnxruntime/core/providers/cuda/cuda_call.cc index 06b4597bb8..6d94570a7e 100644 --- a/onnxruntime/core/providers/cuda/cuda_call.cc +++ b/onnxruntime/core/providers/cuda/cuda_call.cc @@ -17,7 +17,7 @@ namespace onnxruntime { using namespace common; template -const char* CudaErrString(ERRTYPE x) { +const char* CudaErrString(ERRTYPE) { ORT_NOT_IMPLEMENTED(); } diff --git a/onnxruntime/core/providers/cuda/cuda_common.h b/onnxruntime/core/providers/cuda/cuda_common.h index 6a6eca8184..3835da81c8 100644 --- a/onnxruntime/core/providers/cuda/cuda_common.h +++ b/onnxruntime/core/providers/cuda/cuda_common.h @@ -95,7 +95,7 @@ inline bool CalculateFdmStrides(gsl::span p, const std::vector= 7 : true ); #else @@ -118,7 +118,6 @@ class CublasMathModeSetter { } private: - const cudaDeviceProp& prop_; cublasHandle_t handle_; cublasMath_t mode_; bool enable_; diff --git a/onnxruntime/core/providers/cuda/cuda_execution_provider_info.h b/onnxruntime/core/providers/cuda/cuda_execution_provider_info.h index 9ee0a4375a..892f6b6766 100644 --- a/onnxruntime/core/providers/cuda/cuda_execution_provider_info.h +++ b/onnxruntime/core/providers/cuda/cuda_execution_provider_info.h @@ -13,8 +13,8 @@ namespace onnxruntime { // Information needed to construct CUDA execution providers. struct CUDAExecutionProviderExternalAllocatorInfo { - const void* alloc{nullptr}; - const void* free{nullptr}; + void* alloc{nullptr}; + void* free{nullptr}; CUDAExecutionProviderExternalAllocatorInfo() { alloc = nullptr; diff --git a/onnxruntime/core/providers/cuda/cudnn_common.cc b/onnxruntime/core/providers/cuda/cudnn_common.cc index 24f8220eb9..dda49c130f 100644 --- a/onnxruntime/core/providers/cuda/cudnn_common.cc +++ b/onnxruntime/core/providers/cuda/cudnn_common.cc @@ -117,7 +117,7 @@ cudnnDataType_t CudnnTensor::GetDataType() { ORT_THROW("cuDNN engine currently supports only single/double/half/int8/uint8 precision data types. Got:", typeid(ElemType).name()); // Not reachable but GCC complains - return 0; + return CUDNN_DATA_FLOAT; } template<>