diff --git a/onnxruntime/core/providers/cuda/math/gemm.cc b/onnxruntime/core/providers/cuda/math/gemm.cc index a595153e32..57e1b37c0c 100644 --- a/onnxruntime/core/providers/cuda/math/gemm.cc +++ b/onnxruntime/core/providers/cuda/math/gemm.cc @@ -118,7 +118,7 @@ Status Gemm::ComputeInternal(OpKernelContext* ctx) const { out_data, N, device_prop)); } else { // B is (M, N), no broadcast needed. - CUDA_RETURN_IF_ERROR(cudaMemcpyAsync(out_data, b_data, M * N * sizeof(T), cudaMemcpyDeviceToDevice, Stream(ctx))); + CUDA_RETURN_IF_ERROR(cudaMemcpyAsync(out_data, b_data, static_cast(M) * N * sizeof(T), cudaMemcpyDeviceToDevice, Stream(ctx))); } } diff --git a/onnxruntime/core/providers/cuda/tensor/pad.cc b/onnxruntime/core/providers/cuda/tensor/pad.cc index 3955f454d3..4584e5fd82 100644 --- a/onnxruntime/core/providers/cuda/tensor/pad.cc +++ b/onnxruntime/core/providers/cuda/tensor/pad.cc @@ -135,14 +135,14 @@ Status Pad::ComputeInternal(OpKernelContext* ctx) const { TArray input_strides(input_pitches); auto output_dims(input_shape.AsShapeVector()); - ORT_ENFORCE(static_cast(dimension_count * 2) == p_pads->size(), "'pads' attribute has wrong number of values"); + ORT_ENFORCE(static_cast(dimension_count) * 2 == p_pads->size(), "'pads' attribute has wrong number of values"); // Calculate output dimensions, and handle any negative padding TArray lower_pads(dimension_count); TArray upper_pads(dimension_count); for (auto i = 0; i < dimension_count; i++) { lower_pads[i] = (*p_pads)[i] + (*p_slices)[i]; - upper_pads[i] = (*p_pads)[i + dimension_count] + (*p_slices)[i + dimension_count]; + upper_pads[i] = (*p_pads)[static_cast(i) + dimension_count] + (*p_slices)[static_cast(i) + dimension_count]; output_dims[i] += lower_pads[i] + upper_pads[i]; } diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index 71ad046646..2d35f1da94 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -1043,8 +1043,8 @@ struct ProviderSharedLibrary { if (handle_) return; - auto full_path = Env::Default().GetRuntimePath() + - PathString(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_shared") LIBRARY_EXTENSION); + auto full_path = Env::Default().GetRuntimePath() + + PathString(LIBRARY_PREFIX ORT_TSTR("onnxruntime_providers_shared") LIBRARY_EXTENSION); ORT_THROW_IF_ERROR(Env::Default().LoadDynamicLibrary(full_path, true /*shared_globals on unix*/, &handle_)); void (*PProvider_SetHost)(void*); @@ -1681,7 +1681,16 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_CUDA_V2, _In_ ORT_API_STATUS_IMPL(OrtApis::CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2** out) { API_IMPL_BEGIN #ifdef USE_CUDA + +// Need to use 'new' here, so disable C26409 +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable : 26409) +#endif *out = new OrtCUDAProviderOptionsV2(); +#ifdef _WIN32 +#pragma warning(pop) +#endif (*out)->device_id = 0; (*out)->cudnn_conv_algo_search = OrtCudnnConvAlgoSearch::OrtCudnnConvAlgoSearchExhaustive; (*out)->gpu_mem_limit = std::numeric_limits::max(); @@ -1766,7 +1775,19 @@ ORT_API_STATUS_IMPL(OrtApis::GetCUDAProviderOptionsAsString, _In_ const OrtCUDAP ORT_API(void, OrtApis::ReleaseCUDAProviderOptions, _Frees_ptr_opt_ OrtCUDAProviderOptionsV2* ptr) { #ifdef USE_CUDA + +// Need to use 'delete' here, so disable C26409 +#ifdef _WIN32 +#pragma warning(push) +#pragma warning(disable : 26409) +#endif + delete ptr; + +#ifdef _WIN32 +#pragma warning(pop) +#endif + #else ORT_UNUSED_PARAMETER(ptr); #endif