feat: add --allow-unsupported-nodes to perf/build/eval/run#821
Merged
Conversation
…rors The optimize/analyze loop raises "Unsupported nodes persist after N analyze pass(es)" when the static analyzer reports nodes the target EP doesn't support (e.g. Resize on OpenVINO GPU), which aborts the build even though the EP can run the model via CPU fallback. Add an opt-in allow_unsupported_nodes flag that logs a warning instead of raising, threaded from the new `winml perf --allow-unsupported-nodes` CLI flag through WinMLAutoModel.from_pretrained/from_onnx and build_hf_model/build_onnx_model down to run_optimize_analyze_loop. Default is False, so existing behavior is unchanged.
Contributor
Author
|
Note: although AI says |
added 2 commits
June 8, 2026 11:41
Mirror the perf-command flag on the build command. The build command runs its own pipeline orchestration (_run_optimize_stage -> run_optimize_analyze_loop) for single-model HF/ONNX builds and delegates to build_hf_model for module mode, so thread allow_unsupported_nodes through all three paths. When set, the optimize/analyze loop logs a warning instead of raising on persistent unsupported nodes (e.g. Resize on OpenVINO GPU). Default False, so existing behavior is unchanged.
Extract the flag into a reusable cli_utils.allow_unsupported_nodes_option() decorator and adopt it in perf and build (replacing the inline options). Apply the same flag to the other commands that build via WinMLAutoModel.from_*: - eval: new WinMLEvaluationConfig.allow_unsupported_nodes field, auto-mapped from the CLI and forwarded to from_pretrained in eval._load_model. - run: threaded through InferenceEngine.load -> _load_from_hf -> from_pretrained (the run command is currently disabled, but the engine plumbing is shared). ONNX/skip_build load paths don't run the analyzer, so they are left untouched. Default remains False everywhere.
- engine.load docstring: note the flag has no effect on pre-built ONNX / cached build-dir load paths (no analyze step runs there). - build: always set extra_kwargs['allow_unsupported_nodes'] (even when False) so the downstream .pop default isn't load-bearing and both build paths match. - test_common: pin caplog.at_level to the build.common logger.
- auto.from_pretrained: pass allow_unsupported_nodes to the composite-model dispatch (WinMLCompositeModel.from_pretrained); it was a named param, so it was silently dropped for composites (T5, Qwen, ...). - auto.from_onnx: declare allow_unsupported_nodes as an explicit keyword-only param (parallel to skip_build) instead of relying on **kwargs, and forward it explicitly to build_onnx_model; documented it. - Tests: HF/composite/onnx forwarding all reach the build call.
DingmaomaoBJTU
approved these changes
Jun 8, 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.
Problem
winml perf -m depth-anything/Depth-Anything-V2-Small-hf --task depth-estimation --ep openvino --device gpuaborts at the optimize/analyze loop:The static analyzer flags nodes the target EP doesn't fully support (e.g.
Resizeon OpenVINO GPU), so the build raises — even though the EP can still run the model (CPU fallback for those nodes).Change
Add an opt-in
--allow-unsupported-nodesflag that turns the hard failure into a warning and lets the build proceed. The gate lives at the singleraiseinbuild/common.py:The flag is a shared CLI option (
cli_utils.allow_unsupported_nodes_option()) applied to every command that builds a model viaWinMLAutoModel.from_*:winml perfBenchmarkConfig→from_pretrained/from_onnx;--module→build_hf_modelwinml build_run_optimize_stage→run_optimize_analyze_loop; module mode →build_hf_modelwinml evalWinMLEvaluationConfig.allow_unsupported_nodes→from_pretrainedwinml runInferenceEngine.load→_load_from_hf→from_pretrainedONNX /
skip_buildload paths don't run the analyzer, so they're untouched. Default isFalseeverywhere — strictly opt-in. Named--allow-unsupported-nodes(not a generic--force) since it gates exactly this analyzer check.Verification
winml perf ... --ep openvino --device gpu --allow-unsupported-nodes→ builds, compiles on OV GPU, benchmarks (~15.9 ms avg).winml build ... --ep openvino --device gpu --allow-unsupported-nodes→ logs the warning (['OP/ai.onnx/Resize']) and completes.build/test_common.py), and flag passthrough for build/eval/run; full commands + inference + build + eval suites pass (871 tests).🤖 Generated with Claude Code