feat(build): output analyze_result.json; fix --device npu config validation#673
Merged
DingmaomaoBJTU merged 2 commits intoMay 19, 2026
Merged
Conversation
…evice dropping quant.task/model_name ### analyze_result.json output - Add `output_path` param to `analyze_onnx()`: writes full `AnalysisResult` JSON after each call, each overwriting the previous - Thread `analyze_output_path` through `run_optimize_analyze_loop` / `_run_analyze_loop` in `build/common.py` - `build/hf.py` and `build/onnx.py` define `analyze_result_path` and pass it to the loop - `commands/build.py` `_run_optimize_stage` accepts and forwards `analyze_output_path`; `_build_hf_pipeline` / `_build_onnx_pipeline` supply the path ### fix: _patch_device regression (introduced in ed7dbfd, #477) When `--device` was explicitly provided on the CLI, `_patch_device` replaced the entire `cfg.quant` object with a fresh `WinMLQuantizationConfig` that only carried `weight_type` / `activation_type`, silently dropping `task` and `model_name` that `generate_build_config` had already populated. This caused `winml build -m <model> --device npu` to always fail validation. Fix: only update precision fields when an existing quant config is present; fall back to assignment only when there was none.
xieofxie
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.
Summary
analyze_result.json: The full static analysis result is now written to the build output folder after every analyze pass (each pass overwrites the previous), so users can inspect node-level compatibility after a build.--device npufix:winml build -m <model> --device npupreviously always failed with "quant.task is required". This was a regression introduced in ed7dbfd (fix(build): optional config, autoconf status display, EP compatibility fixes, and perf improvements #477).Details
analyze_result.json
analyze_onnx()gains anoutput_pathparameter; when set, it writesAnalysisResult.to_json()to disk after each callrun_optimize_analyze_loop/_run_analyze_loopthreadanalyze_output_paththrough to everyanalyze_onnx()callbuild/hf.py,build/onnx.py, and the CLI's_run_optimize_stageall supplyanalyze_result_path_patch_device regression fix
_patch_devicewas replacing the entirecfg.quantobject with the result ofresolve_quant_compile_config(), which only carriesweight_type/activation_type. This silently droppedtaskandmodel_namethatgenerate_build_config()had already set, causing validation to fail for any device that requires quantization (i.e. NPU).Fix: when an existing quant config is present, only update the precision fields instead of replacing the whole object.