From a60b18c030274417501b1e2d03f0f239f22fa0f2 Mon Sep 17 00:00:00 2001 From: jatinwadhwa921 Date: Wed, 27 Aug 2025 17:45:52 -0700 Subject: [PATCH] [OVEP] Fix cov issues --- .../core/providers/openvino/openvino_provider_factory.cc | 6 +++--- onnxruntime/core/providers/openvino/ov_factory.cc | 2 +- onnxruntime/core/providers/openvino/ov_interface.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/onnxruntime/core/providers/openvino/openvino_provider_factory.cc b/onnxruntime/core/providers/openvino/openvino_provider_factory.cc index bebdb25ccc058..480e4c068664e 100644 --- a/onnxruntime/core/providers/openvino/openvino_provider_factory.cc +++ b/onnxruntime/core/providers/openvino/openvino_provider_factory.cc @@ -171,7 +171,7 @@ std::string ParseDeviceType(std::shared_ptr ov_core, const ProviderOptio if (!device_mode.empty()) { selected_device = device_mode + ":" + ov_luid_devices; for (const auto& dev_str : devices_to_check) { - const auto default_dev = split(dev_str, '.')[0]; + const std::string default_dev = split(dev_str, '.')[0]; if (ov_luid_devices.find(default_dev) == std::string::npos) selected_device = selected_device + "," + dev_str; @@ -532,7 +532,7 @@ struct OpenVINO_Provider : Provider { std::string ov_device_string; if (is_meta_device_factory) { // Build up a meta device string based on the devices that are passed in. E.g. AUTO:NPU,GPU.0,CPU - ov_device_string = ov_meta_device_type; + ov_device_string = std::move(ov_meta_device_type); ov_device_string += ":"; } @@ -545,7 +545,7 @@ struct OpenVINO_Provider : Provider { prepend_comma = true; } - provider_options["device_type"] = ov_device_string; + provider_options["device_type"] = std::move(ov_device_string); // Parse provider info with the device type ProviderInfo pi; diff --git a/onnxruntime/core/providers/openvino/ov_factory.cc b/onnxruntime/core/providers/openvino/ov_factory.cc index 8860405338409..2853cc17726ab 100644 --- a/onnxruntime/core/providers/openvino/ov_factory.cc +++ b/onnxruntime/core/providers/openvino/ov_factory.cc @@ -105,7 +105,7 @@ OrtStatus* OpenVINOEpPluginFactory::GetSupportedDevices(const OrtHardwareDevice* std::string ov_device_name; auto get_gpu_device_id = [&](const std::string& ov_device) { try { - auto device_id_str = ov_core_->get_property(ov_device, "GPU_DEVICE_ID").as(); + const std::string device_id_str = ov_core_->get_property(ov_device, "GPU_DEVICE_ID").as(); return static_cast(std::stoul(device_id_str, nullptr, 0)); } catch (ov::Exception&) { return 0u; // If we can't get the GPU_DEVICE_ID info, we won't have a device ID. diff --git a/onnxruntime/core/providers/openvino/ov_interface.h b/onnxruntime/core/providers/openvino/ov_interface.h index 3e1f829258608..38ea883078e85 100644 --- a/onnxruntime/core/providers/openvino/ov_interface.h +++ b/onnxruntime/core/providers/openvino/ov_interface.h @@ -136,7 +136,7 @@ class OVInferRequest { cached_binding.tensor_ptr.reset(); auto ov_tensor = std::make_shared(type, shape, const_cast(ort_ptr)); ovInfReq.set_tensor(name, *ov_tensor); - cached_binding = {ov_tensor, ort_ptr}; + cached_binding = {std::move(ov_tensor), ort_ptr}; } }