Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/onnxruntime_providers_dml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
if (GDK_PLATFORM STREQUAL Scarlett)
target_link_libraries(onnxruntime_providers_dml PRIVATE ${gdk_dx_libs})
else()
target_link_libraries(onnxruntime_providers_dml PRIVATE dxguid.lib d3d12.lib dxgi.lib dxcore.lib)
target_link_libraries(onnxruntime_providers_dml PRIVATE dxguid.lib d3d12.lib dxgi.lib)
endif()

target_link_libraries(onnxruntime_providers_dml PRIVATE delayimp.lib)
Expand Down
6 changes: 6 additions & 0 deletions onnxruntime/core/framework/execution_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ void ExecutionProviders::EtwProvidersCallback(LPCGUID /* SourceId */,
void ExecutionProviders::LogProviderOptions(const std::string& provider_id,
const ProviderOptions& providerOptions,
bool captureState) {
#ifdef ONNXRUNTIME_ENABLE_INSTRUMENT
for (const auto& config_pair : providerOptions) {
TraceLoggingWrite(
telemetry_provider_handle,
Expand All @@ -131,6 +132,11 @@ void ExecutionProviders::LogProviderOptions(const std::string& provider_id,
TraceLoggingString(config_pair.second.c_str(), "Value"),
TraceLoggingBool(captureState, "isCaptureState"));
}
#else
ORT_UNUSED_PARAMETER(provider_id);
ORT_UNUSED_PARAMETER(providerOptions);
ORT_UNUSED_PARAMETER(captureState);
#endif
}

#endif
Expand Down
20 changes: 19 additions & 1 deletion onnxruntime/core/providers/dml/dml_provider_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ static void SortHeterogenousDXCoreAdapterList(
std::sort(adapter_infos.begin(), adapter_infos.end(), policy);
}

typedef HRESULT(WINAPI* PFN_DXCoreCreateAdapterFactory)(REFIID riid, void** ppvFactory);

std::shared_ptr<IExecutionProviderFactory> DMLProviderFactoryCreator::CreateFromDeviceOptions(
const ConfigOptions& config_options,
const OrtDmlDeviceOptions* device_options,
Expand All @@ -305,9 +307,25 @@ std::shared_ptr<IExecutionProviderFactory> DMLProviderFactoryCreator::CreateFrom
OrtDmlPerformancePreference preference = device_options->Preference;
OrtDmlDeviceFilter filter = device_options->Filter;

// Load dxcore.dll. We do this manually so there's not a hard dependency on dxcore which is newer.
wil::unique_hmodule dxcore_lib{LoadLibraryExW(L"dxcore.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32)};
if (!dxcore_lib) {
ORT_THROW("Failed to load dxcore.dll. Expected on older Windows version that do not support dxcore.");
}

auto pfnDXCoreCreateAdapterFactory = reinterpret_cast<PFN_DXCoreCreateAdapterFactory>(
GetProcAddress(dxcore_lib.get(), "DXCoreCreateAdapterFactory"));

if (!pfnDXCoreCreateAdapterFactory) {
// this isn't expected to fail so ERROR not WARNING
ORT_THROW("Failed to get DXCoreCreateAdapterFactory function address.");
}

// Create DXCore Adapter Factory
ComPtr<IDXCoreAdapterFactory> adapter_factory;
ORT_THROW_IF_FAILED(::DXCoreCreateAdapterFactory(adapter_factory.GetAddressOf()));
if (FAILED(pfnDXCoreCreateAdapterFactory(IID_PPV_ARGS(&adapter_factory)))) {
ORT_THROW("DXCore is not available on this platform. This is expected on older versions of Windows.");
}

// Get all DML compatible DXCore adapters
ComPtr<IDXCoreAdapterList> adapter_list;
Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/inference_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void InferenceSession::TraceSessionOptions(const SessionOptions& session_options

LOGS(logger, INFO) << session_options;

#ifdef _WIN32
#if defined(_WIN32) && defined(ONNXRUNTIME_ENABLE_INSTRUMENT)
std::string optimized_model_filepath = ORT_TSTR_CONVERT_TO_PRINTABLE_STRING(session_options.optimized_model_filepath);
std::string profile_file_prefix = ORT_TSTR_CONVERT_TO_PRINTABLE_STRING(session_options.profile_file_prefix);

Expand Down
2 changes: 1 addition & 1 deletion onnxruntime/core/session/provider_registration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider,
return status;
}

#ifdef _WIN32
#if defined(_WIN32) && defined(ONNXRUNTIME_ENABLE_INSTRUMENT)
for (const auto& config_pair : provider_options) {
TraceLoggingWrite(
telemetry_provider_handle,
Expand Down
Loading