-
Notifications
You must be signed in to change notification settings - Fork 304
Description
Issue: AMD NPU EP Download Error
Background
My PC originally had the AMD NPU Execution Provider (EP) installed.
To verify the automatic EP download functionality, I manually deleted the following two folders under
C:\Program Files\WindowsApps:
Microsoft.WindowsMLRuntime.AMD.NPU.EP_0.1.9.0_x64__8wekyb3d8bbwe
MicrosoftCorporationII.WinML.AMD.NPU.EP.1.8_1.8.26.0_x64__8wekyb3d8bbwe
Then, I added the following test code in
C:\test\WindowsAppSDK\WindowsAppSDK-Samples-main\Samples\WindowsML\cpp\CppConsoleDesktop
to test whether the EP can be automatically redownloaded:
#include <winrt/Microsoft.Windows.AI.MachineLearning.h>
#include <winml/onnxruntime_cxx_api.h>
#include <winrt/Windows.Foundation.h>
#include <iostream>
#include <vector>
int main()
{
try
{
winrt::init_apartment();
Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "CppDemo");
std::cout << "ONNX Version string: " << Ort::GetVersionString() << std::endl;
std::cout << "Getting available providers..." << std::endl;
auto catalog = winrt::Microsoft::Windows::AI::MachineLearning::ExecutionProviderCatalog::GetDefault();
catalog.EnsureAndRegisterCertifiedAsync().get();
auto providers = catalog.FindAllProviders();
std::cout << "Available providers from catalog:" << std::endl;
for (auto const& provider : providers)
{
std::wcout << L" Provider: " << provider.Name().c_str() << std::endl;
provider.EnsureReadyAsync().get();
provider.TryRegister();
}
std::vector<Ort::ConstEpDevice> ep_devices = env.GetEpDevices();
std::cout << "All available EP devices:" << std::endl;
for (const auto& d : ep_devices)
{
std::cout << " EP Name: " << d.EpName() << ", Device ID: " << std::endl;
}
std::vector<Ort::ConstEpDevice> selected_ep_devices;
for (const auto& d : ep_devices)
{
if (std::string(d.EpName()) == "VitisAIExecutionProvider")
{
selected_ep_devices.push_back(d);
std::cout << "Found AMD NPU device: " << d.EpName() << std::endl;
}
}
if (selected_ep_devices.empty())
{
throw std::runtime_error("VitisAIExecutionProvider is not available on this system.");
}
Ort::SessionOptions sessionOptions;
sessionOptions.SetEpSelectionPolicy(OrtExecutionProviderDevicePolicy_MAX_EFFICIENCY);
std::cout << "SessionOptions configured with AMD NPU EP." << std::endl;
}
catch (const std::exception& ex)
{
std::cerr << "Error: " << ex.what() << std::endl;
}
return 0;
}
However, when I run the program, I get the following output:
ONNX Version string: 1.23.1
Getting available providers...
Available providers from catalog:
Provider: VitisAIExecutionProvider
All available EP devices:
EP Name: CPUExecutionProvider, Device ID:
EP Name: DmlExecutionProvider, Device ID:
EP Name: DmlExecutionProvider, Device ID:
Error: VitisAIExecutionProvider is not available on this system.
In fact, the deleted EP directories were not re-downloaded, which means the following call did not work as expected:
auto catalog = winrt::Microsoft::Windows::AI::MachineLearning::ExecutionProviderCatalog::GetDefault();
catalog.EnsureAndRegisterCertifiedAsync().get();
To restore functionality, I copied my backup folders
(MicrosoftCorporationII.WinML.AMD.NPU.EP.1.8_1.8.26.0_x64__8wekyb3d8bbwe)
back into C:\Program Files\WindowsApps, but the same error still occurs.
Therefore, I would like to ask how I can make the EP re-download the correct AMD NPU Execution Provider files so that the NPU can work properly?
I suspect that my deletion method was incorrect, which caused the automatic re-download and detection mechanism to stop working. Is there any way to restore it to normal?
