Skip to content

Commit d464b2a

Browse files
adrastogiAditya RastogiCopilot
authored
Add example and documentation for kOrtEpDevice_EpMetadataKey_OSDriverVersion (#28282)
### Description <!-- Describe your changes. --> This change provides details on the expected value for `kOrtEpDevice_EpMetadataKey_OSDriverVersion` and provides an example in the plugin EP tests. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> We introduced a new EP metadata key called `kOrtEpDevice_EpMetadataKey_OSDriverVersion` in #26616 but neglected to provide sufficient detail to guide EP authors in how to fill in the value for this key. This PR is an attempt to address that gap. --------- Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent b2f6e15 commit d464b2a

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

include/onnxruntime/core/session/onnxruntime_ep_device_ep_metadata_keys.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
static const char* const kOrtEpDevice_EpMetadataKey_Version = "version";
1111

1212
// Key for the execution provider OS driver version.
13+
// Value should be a 4-part dot-separated version string in the format "a.b.c.d" (e.g., "31.0.101.4502").
14+
// This maps to the Windows DXCore adapter property DXCoreAdapterProperty::DriverVersion
15+
// (https://learn.microsoft.com/en-us/windows/win32/api/dxcore_interface/ne-dxcore_interface-dxcoreadapterproperty).
16+
// On non-Windows platforms, the EP should provide an equivalent OS-level driver version if available.
1317
static const char* const kOrtEpDevice_EpMetadataKey_OSDriverVersion = "os_driver_version";
1418

1519
// Prefix for execution provider compatibility information stored in model metadata.

onnxruntime/test/autoep/library/example_plugin_ep/ep_factory.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ep_data_transfer.h"
1212
#include "ep_stream_support.h"
1313

14+
#include "core/session/onnxruntime_ep_device_ep_metadata_keys.h"
1415
#include "core/session/onnxruntime_session_options_config_keys.h"
1516

1617
ExampleEpFactory::ExampleEpFactory(const char* ep_name, ApiPtrs apis, const OrtLogger& default_logger)
@@ -141,6 +142,9 @@ OrtStatus* ORT_API_CALL ExampleEpFactory::GetSupportedDevicesImpl(OrtEpFactory*
141142

142143
// random example using made up values
143144
factory->ort_api.AddKeyValuePair(ep_metadata, "supported_devices", "CrackGriffin 7+");
145+
// Example os_driver_version. A real EP would read the OS driver version from the device.
146+
// The format is a 4-part dot-separated version matching the DXCore DriverVersion property.
147+
factory->ort_api.AddKeyValuePair(ep_metadata, kOrtEpDevice_EpMetadataKey_OSDriverVersion, "31.0.101.1000");
144148
factory->ort_api.AddKeyValuePair(ep_options, "run_really_fast", "true");
145149

146150
// OrtEpDevice copies ep_metadata and ep_options.
@@ -171,6 +175,7 @@ OrtStatus* ORT_API_CALL ExampleEpFactory::GetSupportedDevicesImpl(OrtEpFactory*
171175
// Ort::KeyValuePairs ep_metadata;
172176
// Ort::KeyValuePairs ep_options;
173177
// ep_metadata.Add("supported_devices", "CrackGriffin 7+");
178+
// ep_metadata.Add(kOrtEpDevice_EpMetadataKey_OSDriverVersion, "31.0.101.1000");
174179
// ep_options.Add("run_really_fast", "true");
175180
// Ort::EpDevice ep_device{*this_ptr, device, ep_metadata.GetConst(), ep_options.GetConst()};
176181
// ep_devices[num_ep_devices++] = ep_device.release();

onnxruntime/test/autoep/test_registration.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ TEST(OrtEpLibrary, LoadUnloadPluginLibraryCxxApi) {
7070
auto metadata = test_ep_device->EpMetadata();
7171
ASSERT_STREQ(metadata.GetValue(kOrtEpDevice_EpMetadataKey_Version), "0.1.0");
7272
ASSERT_STREQ(metadata.GetValue("supported_devices"), "CrackGriffin 7+");
73+
// Verify the example plugin's expected os_driver_version value.
74+
ASSERT_STREQ(metadata.GetValue(kOrtEpDevice_EpMetadataKey_OSDriverVersion), "31.0.101.1000");
7375

7476
auto options = test_ep_device->EpOptions();
7577
ASSERT_STREQ(options.GetValue("run_really_fast"), "true");

0 commit comments

Comments
 (0)