-
Notifications
You must be signed in to change notification settings - Fork 180
[Fix]Incorrect CPU Tagging for AITK NPU Models by Enhancing EP Detection #524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+428
−74
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
Contributor
|
@weiyuanyue I've opened a new pull request, #525, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
haoliuu
reviewed
Dec 4, 2025
haoliuu
approved these changes
Dec 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AITK-converted NPU models were incorrectly tagged as CPU because the detection logic couldn't parse diverse execution provider configurations from
genai_config.json.Root Cause
The existing implementation had several limitations:
Before/After
Before: NPU model shows CPU tag

After: NPU model correctly tagged

Warning dialog for unavailable EPs:

Solution
This PR implements a comprehensive fix with 4 key improvements:
Enhanced GenAI Config Parsing (GenAIConfig.cs)
HasProvider()andGetProviderOptions()methods to handle different config structuresRobust Hardware Detection (DeviceUtils.cs, new ExecutionProviderNames.cs)
HasNPU()method using ONNX Runtime's execution provider device detectionGetEpDevices()to query all available EPs on the device by ensuring certified execution providers are registered before detectionExecutionProviderNamesconstants class to eliminate hardcoded EP strings and ensure consistency across the codebaseIntelligent Model Classification and Validation (UserAddedModelUtil.cs, ModelCompatibility.cs)
GetHardwareAcceleratorFromConfig()to:ValidateExecutionProviders()to validate required EPs are available before model loadingModelCompatibility.cswith proper error messagingCode Quality Improvements
ExecutionProviderNamesconstants throughout (ScenarioPage.xaml.cs,WinMLHelpers.cs)Testing
Notes
In the current workflow introduced by this PR, the early validation during model addition only checks for EP availability (e.g., attempting to load QNN EP on an Intel machine will trigger a warning dialog). It does not include hardware capability checks (such as verifying the size of dedicated video memory). Hardware capability validation occurs later during model loading, where incompatible models are hidden.
Future work will involve refining compatibility rules and improving the timing of these checks.
Known related issue #523 (will not be fixed in this PR)