Skip to content

Conversation

ankitm3k
Copy link

@ankitm3k ankitm3k commented Oct 10, 2025

Description

This PR enables the ETW Traces Logging for OVEP for Windows OS. Currently, this PR enables logging all the Session & Provider Options supported by OVEP during runtime. Usage is governed by using below data inside ort_traces.wprp file -
Provider Name: Intel.ML.ONNXRuntime.OpenVINO
Provider GUID: b5a8c2e1-4d7f-4a3b-9c2e-1f8e5a6b7c9d

The ovep_traces.wprp file MUST include below config to enable ETW tracing for OVEP explicitly -

    <!-- OpenVINO EP provider -->
    <EventProvider Id="EventProvider_OpenVINOExecutionProvider"
      Name="b5a8c2e1-4d7f-4a3b-9c2e-1f8e5a6b7c9d" Level="5">
      <CaptureStateOnSave>
        <Keyword Value="0xffffffffffffffff"/> <!-- capture all keywords -->
      </CaptureStateOnSave>
    </EventProvider>


.... existing configuration ....

<Collectors>
        <EventCollectorId Value="EventCollector_OrtTraceLoggingProvider">
          <EventProviders>
            <EventProviderId Value="EventProvider_OrtTraceLoggingProvider" />
            <EventProviderId Value="EventProvider_OpenVINOExecutionProvider" />
          </EventProviders>
        </EventCollectorId>
      </Collectors>

Sample Commands to get the ETW traces using onnxruntime_perf_test.exe app -

wpr -start ovep_traces.wprp

onnxruntime_perf_test.exe -e openvino -m times -r 10 -o 0 -I -i "device_type|NPU" "C:\Users\Windows\Downloads\model.onnx"

wpr -stop ort_ovep_trace.etl -compress

This PR fulfills below request - https://jira.devtools.intel.com/browse/CVS-174008

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables ETW (Event Tracing for Windows) logging for the OpenVINO Execution Provider (OVEP) to support runtime tracing of session and provider options. The implementation adds comprehensive logging capabilities that can be consumed through Windows Performance Recorder (WPR) tools for debugging and monitoring OVEP behavior.

  • Introduces a new telemetry system with ETW provider registration and structured JSON logging
  • Adds configuration to Windows Performance Recording Profile for OVEP tracing
  • Integrates telemetry logging into the OpenVINO execution provider lifecycle

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ort.wprp Adds OpenVINO EP event provider configuration to Windows Performance Recording Profile
ov_telemetry.h Defines telemetry interface and ETW provider declarations for OpenVINO EP
ov_telemetry.cc Implements ETW tracing functionality with JSON serialization for provider/session options
openvino_execution_provider.h Adds telemetry includes and session tracking members
openvino_execution_provider.cc Integrates telemetry logging into provider constructor

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +56 to +57
std::lock_guard<std::mutex> lock_callbacks(callbacks_mutex_);
callbacks_.clear();
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential deadlock scenario: The destructor acquires callbacks_mutex_ while already holding mutex_. If another thread calls RegisterInternalCallback or UnregisterInternalCallback while the destructor is running, it could create a deadlock. Consider releasing the first lock before acquiring the second, or use a single mutex for both operations.

Copilot uses AI. Check for mistakes.

AddOptionalValue(sopts, "ep.context_enable", ctx.so_context_enable, false, first);
AddOptionalValue(sopts, "session.disable_cpu_ep_fallback", ctx.so_disable_cpu_ep_fallback, false, first);
AddOptionalValue(sopts, "ep.context_embed_mode", ctx.so_context_embed_mode, false, first);
AddOptionalValue(sopts, "ep.context_file_path", ctx.so_share_ep_contexts, false, first);
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect parameter mapping: The function is called with 'ep.context_file_path' as the key but ctx.so_share_ep_contexts as the value, which is a boolean. This should likely be ctx.so_context_file_path or a different key name to match the boolean value being passed.

Suggested change
AddOptionalValue(sopts, "ep.context_file_path", ctx.so_share_ep_contexts, false, first);
AddOptionalValue(sopts, "ep.context_file_path", ctx.so_context_file_path, std::filesystem::path(), first);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant