Skip to content
5 changes: 5 additions & 0 deletions cmake/onnxruntime_providers_openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${OpenVINO_INCLUDE_DIR} ${OPENVINO_INCLUDE_DIR_LIST} ${PYTHON_INCLUDE_DIRS} $ENV{OPENCL_INCS} $ENV{OPENCL_INCS}/../../cl_headers/)
target_link_libraries(onnxruntime_providers_openvino ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 ${OPENVINO_LIB_LIST} ${ABSEIL_LIBS} Eigen3::Eigen onnx_proto)

# ETW TraceLogging depends on Advapi32 on Windows
if(WIN32)
target_link_libraries(onnxruntime_providers_openvino advapi32)
endif()

target_compile_definitions(onnxruntime_providers_openvino PRIVATE FILE_NAME=\"onnxruntime_providers_openvino.dll\")

if(MSVC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
namespace onnxruntime {
namespace openvino_ep {

std::atomic<uint32_t> OpenVINOExecutionProvider::global_session_counter_{0};

// Parking this code here for now before it's moved to the factory
#if defined OPENVINO_CONFIG_HETERO || defined OPENVINO_CONFIG_MULTI || defined OPENVINO_CONFIG_AUTO
static std::vector<std::string> parseDevices(const std::string& device_string,
Expand Down Expand Up @@ -58,6 +60,13 @@ OpenVINOExecutionProvider::OpenVINOExecutionProvider(const ProviderInfo& info, s
shared_context_{std::move(shared_context)},
ep_ctx_handle_{session_context_.openvino_sdk_version, *GetLogger()} {
InitProviderOrtApi();
#ifdef _WIN32
session_id_ = global_session_counter_.fetch_add(1) + 1;
// Trace all provider options as one event
OVTelemetry::Instance().LogAllProviderOptions(session_id_, session_context_);
// Trace all session-related flags and inferred states
OVTelemetry::Instance().LogAllSessionOptions(session_id_, session_context_);
#endif
}

OpenVINOExecutionProvider::~OpenVINOExecutionProvider() {
Expand Down
12 changes: 12 additions & 0 deletions onnxruntime/core/providers/openvino/openvino_execution_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
#include <vector>
#include <set>
#include <utility>
#include <atomic>

#include "core/providers/openvino/backend_manager.h"
#include "core/providers/openvino/contexts.h"

#ifdef _WIN32
#include "core/providers/openvino/ov_telemetry.h"
#endif

namespace onnxruntime {
namespace openvino_ep {

Expand Down Expand Up @@ -74,6 +79,13 @@ class OpenVINOExecutionProvider : public IExecutionProvider {
std::shared_ptr<SharedContext> shared_context_;
std::list<BackendManager> backend_managers_; // EP session owns the backend objects
EPCtxHandler ep_ctx_handle_;

// Telemetry and session tracking
mutable uint32_t session_id_;
static std::atomic<uint32_t> global_session_counter_;
#ifdef _WIN32
onnxruntime::logging::EtwRegistrationManager::EtwInternalCallback callback_etw_;
#endif
};

} // namespace openvino_ep
Expand Down
Loading
Loading