Skip to content

analyze: resolve --ep/--device auto to a single best target#919

Open
fangyangci wants to merge 2 commits into
mainfrom
fangyangci/fixAnalyzeCommand
Open

analyze: resolve --ep/--device auto to a single best target#919
fangyangci wants to merge 2 commits into
mainfrom
fangyangci/fixAnalyzeCommand

Conversation

@fangyangci

@fangyangci fangyangci commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

winml analyze previously treated --ep auto / --device auto as "fan out over every locally-available EP/device pair", which was inconsistent with build / run / perf (they resolve a single best target). This PR makes analyze's auto resolution single-target, reusing the shared sysinfo helpers (resolve_device / resolve_eps).

--ep all / --device all keep their full fan-out semantics — unchanged.

Resolution rules (per axis)

value resolves to
auto a single best target via shared resolve_device() / resolve_eps() — local-availability based (device priority NPU > GPU > CPU, EP priority IHV-first)
all the full rule-data-backed set (fan-out) — unchanged
concrete (qnn, gpu, …) itself

The cartesian product + EP_SUPPORTED_DEVICES filtering is unchanged, so mixed combos like --ep all --device auto work naturally (all EPs × the one resolved device). The old local-pairs intersection / half-auto warning block is removed — single-target auto is local by construction.

Behavior changes

command before after
analyze (default auto / auto) all local pairs 1 pair (best device + its best EP)
--ep openvino (device auto) all OpenVINO devices + warning 1 pair
--ep auto --device gpu all GPU EPs + warning 1 pair
--ep all --device all full matrix unchanged

Breaking: auto now requires local hardware

Because auto resolves from local availability (like build / run), pinning a non-local EP with --device auto now exits 2 instead of warning-and-running:

$ winml analyze -m model.onnx --ep qnn      # on a machine without QNN
ERROR  Could not auto-select a device: Requested EP 'qnn' is not available on this system.

To statically analyze an EP you don't physically have, specify the device explicitly (--ep qnn --device npu) or use --device all.

Verified on real hardware

On a box with Intel OpenVINO (NPU + CPU) and NVIDIA TensorRT-RTX (GPU):

command execution target(s)
analyze (default) OpenVINOExecutionProvider (NPU)
--device gpu NvTensorRTRTXExecutionProvider (GPU)
--ep openvino --device auto OpenVINOExecutionProvider (NPU)
--ep openvino --device all OpenVINO × NPU / GPU / CPU
--ep qnn exit 2 (QNN not available)

@fangyangci fangyangci changed the title fix analyze auto command analyze: resolve --ep/--device auto to a single best target Jun 18, 2026
@fangyangci fangyangci marked this pull request as ready for review June 18, 2026 09:32
@fangyangci fangyangci requested a review from a team as a code owner June 18, 2026 09:32
@fangyangci fangyangci enabled auto-merge (squash) June 18, 2026 09:32
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.

1 participant