Skip to content

feat(build): optional -c/--config, auto field, autoconf UX (#477)#603

Closed
DingmaomaoBJTU wants to merge 3 commits into
mainfrom
qiowu/feat-477-build-ux
Closed

feat(build): optional -c/--config, auto field, autoconf UX (#477)#603
DingmaomaoBJTU wants to merge 3 commits into
mainfrom
qiowu/feat-477-build-ux

Conversation

@DingmaomaoBJTU
Copy link
Copy Markdown
Collaborator

Summary

Port winml build UX improvements from #477:

  • Optional -c/--config: omit it to auto-generate the build config from -m <model> directly (one-step workflow; -m becomes required when -c is omitted)
  • WinMLBuildConfig.auto field (default True): the build pipeline sets it to False after the optimize + autoconf loop and saves it into winml_build_config.json — marks the config as "already resolved" so CI/CD pipelines or subsequent winml build -c runs skip the analyzer on reuse
  • Setup header now shows (autoconf on) / (autoconf off) next to the config name
  • Summary section prints the saved config path after the final artifact

Changed files

File Change
src/winml/modelkit/config/build.py Add auto: bool = True to WinMLBuildConfig; to_dict() omits it when True, writes "auto": false when False; generate_cache_key() excludes it
src/winml/modelkit/build/common.py run_optimize_analyze_loop() respects auto=False (skips autoconf) and sets config.auto = False after the loop
src/winml/modelkit/commands/build.py -c made optional; auto-generate config path; pass auto to print_setup; pass config path to print_final
src/winml/modelkit/utils/console.py print_setup() shows autoconf status; print_final() prints saved config path
tests/cli/test_main.py TestBuildCommandArgs: arg-validation tests for optional -c
tests/unit/config/test_build.py TestWinMLBuildConfigAutoField: roundtrip and serialization tests for auto field

@DingmaomaoBJTU DingmaomaoBJTU requested a review from a team as a code owner May 12, 2026 09:49
@xieofxie
Copy link
Copy Markdown
Contributor

tests need fixed

default=None,
help="WinMLBuildConfig JSON file. If omitted, config is auto-generated from -m.",
)
@click.option(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use cli_utils?

raise click.UsageError("-m/--model is required when -c is not provided.")
from ..config import generate_build_config

config_or_configs = generate_build_config(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting that we do not have a flag in this function but have to generate everything and set to None afterwards..

Comment thread src/winml/modelkit/commands/build.py Outdated
console,
model=model_id or "random-init",
config=Path(config_file).name,
config=Path(config_file).name if config_file else "(auto)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make (auto) a const

Comment thread src/winml/modelkit/config/build.py Outdated
result.update(
{
"export": self.export.to_dict() if self.export is not None else None,
"optim": self.optim.to_dict(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also support non-optim?

Comment thread src/winml/modelkit/cli.py
# 5-row block-letter art for "WinML CLI". '#' = filled pixel, ' ' = empty.
# All letters use the same █ character so identical shapes (i vs I) look
# consistent regardless of horizontal position.
_LETTER_ART: dict[str, list[str]] = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port winml build UX improvements from #477:
- -c/--config is now optional; omit it to auto-generate config from -m
  (-m becomes required when -c is omitted)
- WinMLBuildConfig gains auto: bool = True; pipeline sets it to False
  after the optimize+autoconf loop and saves it into winml_build_config.json
  so subsequent runs skip the analyzer on reuse
- Setup header shows (autoconf on)/(autoconf off) next to config name
- Summary section prints the saved config path after the final artifact
test_build_omit_config_requires_model timed out in CI (26 min) because
`winml build -o out/` (no -c, no -m) passed the output/cache check then
hit WinMLEPRegistry.get_instance() — which loads native DLLs — before
reaching the UsageError for missing -m.

Move the config-file-less model check before the EP auto-selection block
so the error is raised cheaply without touching hardware.
- Use @build_config_option from cli_utils for -c/--config (replaces
  inline @click.option, gains path_type=Path so config_file is Path|None)
- Add _CONFIG_AUTO_LABEL = "(auto)" module-level const; replace all
  string literals "(auto)" with it
- Fix no_compile check in auto-generate path: `if no_compile is True`
  (matches tristate from #570 — None means inherit, not skip)
- Add None guard for optim in to_dict() for parity with export/quant/compile
- Rebase onto main: drops redundant banner commit (already merged as #572)
@DingmaomaoBJTU DingmaomaoBJTU force-pushed the qiowu/feat-477-build-ux branch from 6ecd0fa to f842a12 Compare May 13, 2026 03:09
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.

2 participants