microsoft / microsoft/WindowsAppSDK-Samples

AMD NPU EP download error——Error: VitisAIExecutionProvider is not available on this system.

Open
#561 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-winml
Dominant language
PowerShell
Stars
1k
Forks
335
Avg merge
5d 1h
Merged PRs (30d)
8

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?

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CppConsoleDesktop sample and the calls to ExecutionProviderCatalog::GetDefault, EnsureAndRegisterCertifiedAsync, FindAllProviders, and EnsureReadyAsync. Reproduce the missing VitisAIExecutionProvider after deleting the listed WindowsApps folders, then determine the documented recovery path; done means the certified provider is restored and appears in the EP device list.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.