Skip to content

Load WinML runtime DLL for SDK EP discovery#733

Merged
baijumeswani merged 4 commits into
mainfrom
prathikrao/winml-python-bugfix
May 28, 2026
Merged

Load WinML runtime DLL for SDK EP discovery#733
baijumeswani merged 4 commits into
mainfrom
prathikrao/winml-python-bugfix

Conversation

@prathikr
Copy link
Copy Markdown
Contributor

@prathikr prathikr commented May 27, 2026

Summary

  • Load Microsoft.Windows.AI.MachineLearning.dll from the Core native directory for the Python SDK when present.
  • Preload the same WinML runtime DLL for Rust winml builds from the native runtime directory.
  • Preload the WinML runtime DLL for C# WinML builds alongside ORT and ORT GenAI.
  • No JS SDK code change needed; its existing loader already handles the native runtime directory.

Validation

  • Rust WinML EP smoke without a caller PATH override discovered CUDA, OpenVINO, and NvTensorRTRTX, then registered OpenVINO.
  • C# WinML source smoke without a caller PATH override discovered CUDA, OpenVINO, and NvTensorRTRTX, then registered OpenVINO.
  • JS EP smoke without a caller PATH override discovered CUDA, OpenVINO, and NvTensorRTRTX, then registered OpenVINO.

Copilot AI review requested due to automatic review settings May 27, 2026 18:51
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment May 27, 2026 11:05pm

Request Review

baijumeswani
baijumeswani previously approved these changes May 27, 2026
Copy link
Copy Markdown
Contributor

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 updates the Python SDK’s native library initialization on Windows to optionally load the WinML runtime DLL (Microsoft.Windows.AI.MachineLearning.dll) when it is present, enabling WinML execution providers in the WinML variant of the package.

Changes:

  • Add a cached _winml_library handle to CoreInterop to keep the WinML DLL loaded for the process lifetime.
  • During Windows initialization, detect and load Microsoft.Windows.AI.MachineLearning.dll from the Core binary directory when present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk/python/src/detail/core_interop.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Preload Microsoft.Windows.AI.MachineLearning.dll from the native runtime directory for WinML SDK variants so callers do not need to add that directory to PATH for EP discovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 changed the title bug fix for winml 2.0 changes with python sdk Load WinML runtime DLL for SDK EP discovery May 27, 2026
The C# SDK already resolves the WinML runtime through its normal native dependency layout, so avoid explicitly preloading Microsoft.Windows.AI.MachineLearning.dll.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baijumeswani baijumeswani merged commit 2992fda into main May 28, 2026
33 of 50 checks passed
@baijumeswani baijumeswani deleted the prathikrao/winml-python-bugfix branch May 28, 2026 00:03
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.

4 participants