mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Fix some prefast warnings (#14247)
This commit is contained in:
parent
dee36f8ade
commit
3898b22a1a
3 changed files with 26 additions and 5 deletions
|
|
@ -118,7 +118,7 @@ Status Gemm<T>::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<size_t>(M) * N * sizeof(T), cudaMemcpyDeviceToDevice, Stream(ctx)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,14 +135,14 @@ Status Pad<T>::ComputeInternal(OpKernelContext* ctx) const {
|
|||
TArray<int64_t> input_strides(input_pitches);
|
||||
|
||||
auto output_dims(input_shape.AsShapeVector());
|
||||
ORT_ENFORCE(static_cast<size_t>(dimension_count * 2) == p_pads->size(), "'pads' attribute has wrong number of values");
|
||||
ORT_ENFORCE(static_cast<size_t>(dimension_count) * 2 == p_pads->size(), "'pads' attribute has wrong number of values");
|
||||
|
||||
// Calculate output dimensions, and handle any negative padding
|
||||
TArray<int64_t> lower_pads(dimension_count);
|
||||
TArray<int64_t> 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<int64_t>(i) + dimension_count] + (*p_slices)[static_cast<int64_t>(i) + dimension_count];
|
||||
output_dims[i] += lower_pads[i] + upper_pads[i];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<size_t>::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
|
||||
|
|
|
|||
Loading…
Reference in a new issue