fix(sysinfo): raise on explicit device with no compatible EP (#431)#660
Merged
Merged
Conversation
Previously `resolve_device("npu")` logged a warning and returned the
requested device anyway when no NPU EP (QNN/VitisAI/OpenVINO) was
advertised. Callers happily wrote a config naming an unavailable EP,
turning a recoverable misconfiguration into a confusing compile/inference
failure later.
For explicit device requests (non-``auto``), raise ``ValueError`` instead
so ``winml config --device npu ...`` exits non-zero with a message naming
the EPs the user needs to install. The existing ``except ValueError`` in
``commands/config.py`` and ``commands/build.py`` already routes this to a
clean ``click.UsageError`` — no caller changes required.
``--device auto`` is intentionally unchanged: it walks the priority list
and falls through to GPU/CPU when an NPU EP is missing.
zhenchaoni
approved these changes
May 19, 2026
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
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.
Closes #431.
Summary
winml config --device npupreviously logged a warning and exited 0 with an unusable config when no NPU EP (QNN / VitisAI / OpenVINO) was advertised. The failure surfaced later at compile/inference time, far from the misconfiguration.resolve_device()now raisesValueErrorfor explicit device requests with no compatible EP.commands/config.pyandcommands/build.pyalready routeValueErrortoclick.UsageError→ non-zero exit with a clean message naming the missing EPs.--device autois unchanged: it still walks the priority list and falls through to GPU/CPU when an NPU EP is missing (acceptance criterion 3).Before / after
Before (on a box with NPU silicon but no QNN/VitisAI/OpenVINO):
After: