Skip to content

Commit cf61c92

Browse files
authored
Add LUID to OrtHardwareDevice metadata if available. (microsoft#25221)
### Description <!-- Describe your changes. --> Add the LUID to metadata. ### 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. --> Requested by partners.
1 parent 5131596 commit cf61c92

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

onnxruntime/core/platform/windows/device_discovery.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ std::unordered_map<uint64_t, DeviceInfo> GetDeviceInfoD3D12() {
336336
info.device_id = desc.DeviceId;
337337
info.description = std::wstring(desc.Description);
338338

339+
info.metadata[L"LUID"] = std::to_wstring(key);
339340
info.metadata[L"DxgiAdapterNumber"] = std::to_wstring(i);
340341
info.metadata[L"DxgiVideoMemory"] = std::to_wstring(desc.DedicatedVideoMemory / (1024 * 1024)) + L" MB";
341342
}
@@ -436,17 +437,17 @@ std::unordered_map<uint64_t, DeviceInfo> GetDeviceInfoDxcore() {
436437
continue;
437438
}
438439

439-
DeviceInfo& info = device_info[key];
440-
441440
// Get hardware identifying information
442441
DXCoreHardwareIDParts idParts = {};
443442
if (!adapter->IsPropertySupported(DXCoreAdapterProperty::HardwareIDParts) ||
444443
FAILED(adapter->GetProperty(DXCoreAdapterProperty::HardwareIDParts, sizeof(idParts), &idParts))) {
445444
continue; // also need valid ids
446445
}
447446

447+
DeviceInfo& info = device_info[key];
448448
info.vendor_id = idParts.vendorID;
449449
info.device_id = idParts.deviceID;
450+
info.metadata[L"LUID"] = std::to_wstring(key);
450451

451452
// Is this a GPU or NPU
452453
if (adapter->IsAttributeSupported(DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS)) {

0 commit comments

Comments
 (0)