Skip to content

Add EP and device targeting to optimize - #1256

Open
xieofxie wants to merge 4 commits into
mainfrom
hualxie/add_ep_device_to_optimize
Open

Add EP and device targeting to optimize#1256
xieofxie wants to merge 4 commits into
mainfrom
hualxie/add_ep_device_to_optimize

Conversation

@xieofxie

Copy link
Copy Markdown
Contributor

Summary

  • add --ep\ and --device\ options to resolve provider-aware optimization targets
  • bind ORT graph optimization to the resolved EP device while preserving CPU as the default
  • report node-count increases accurately and cover target forwarding/provider binding

@xieofxie
xieofxie requested a review from a team as a code owner July 30, 2026 08:57

@DingmaomaoBJTU DingmaomaoBJTU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good feature — makes --check-optim target-aware so it can skip capabilities irrelevant to the target EP and run the ORT optimization session with the resolved provider. Well-tested.

Comment thread src/winml/modelkit/optim/analysis.py Outdated
Comment thread src/winml/modelkit/optim/analysis.py
Comment thread src/winml/modelkit/commands/optimize.py
Comment thread src/winml/modelkit/optim/pipes/graph.py
Comment thread src/winml/modelkit/commands/optimize.py
Comment thread src/winml/modelkit/utils/cli.py

@DingmaomaoBJTU DingmaomaoBJTU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Second pass. Found an important merge interaction with PR #1257 in _iter_findings — see inline comment on analysis.py.

Also verified: default_kwargs.update(optimizer_kwargs) forwards ep_device to ALL pipes via build_config(**kwargs). Safe because other pipes accept **kwargs and ignore unknown keys. The provider verification after ORT session creation (graph.py) addresses my first-pass concern about silent EP fallback.

Comment thread src/winml/modelkit/optim/analysis.py Outdated
Comment thread src/winml/modelkit/commands/optimize.py
Comment thread src/winml/modelkit/optim/pipes/graph.py

@DingmaomaoBJTU DingmaomaoBJTU left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. EP/device targeting is well-implemented with proper provider verification. The merge interaction with PR #1257 (EP constraint continue bypasses complete_probe) needs a one-line fix in whichever merges second — non-blocking for approval.

…_to_optimize

# Conflicts:
#	src/winml/modelkit/commands/optimize.py
#	src/winml/modelkit/optim/analysis.py
#	tests/unit/commands/test_optimize_cli.py
#	tests/unit/optim/test_analysis.py
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