mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-28 20:11:22 +00:00
Prefast warning fixes (#15175)
### Description transpose.cc: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). cuda_provider_factory.cc: The type 'struct onnxruntime::ProviderInfo_CUDA_Impl' with a virtual function needs either public virtual or protected non-virtual destructor (c.35).
This commit is contained in:
parent
f752bb9973
commit
659118f939
2 changed files with 3 additions and 2 deletions
|
|
@ -52,7 +52,8 @@ std::unique_ptr<IExecutionProvider> CUDAProviderFactory::CreateProvider() {
|
|||
return std::make_unique<CUDAExecutionProvider>(info_);
|
||||
}
|
||||
|
||||
struct ProviderInfo_CUDA_Impl : ProviderInfo_CUDA {
|
||||
struct ProviderInfo_CUDA_Impl final : ProviderInfo_CUDA {
|
||||
|
||||
OrtStatus* SetCurrentGpuDeviceId(_In_ int device_id) override {
|
||||
int num_devices;
|
||||
auto cuda_err = ::cudaGetDeviceCount(&num_devices);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ Status Transpose::DoTranspose(const cudaDeviceProp& prop,
|
|||
new_input_dims[prev] *= new_input_dims[curr];
|
||||
new_input_dims[curr] = 1;
|
||||
for (auto j = static_cast<int32_t>(curr + 1); j < new_rank; j++) {
|
||||
new_input_dims[j - 1] = new_input_dims[j];
|
||||
new_input_dims[static_cast<ptrdiff_t>(j) - 1] = new_input_dims[j];
|
||||
}
|
||||
new_input_dims[new_rank - 1] = 1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue