Skip to content

feat(optim): show custom operator domains - #1306

Open
xieofxie wants to merge 1 commit into
mainfrom
hualxie/optim_show_domain
Open

feat(optim): show custom operator domains#1306
xieofxie wants to merge 1 commit into
mainfrom
hualxie/optim_show_domain

Conversation

@xieofxie

Copy link
Copy Markdown
Contributor

Summary

  • preserve ONNX node domains in optimization analysis results
  • qualify non-default-domain operators in --check-optim output, such as com.microsoft::Gelu
  • include custom domains in structured optimization-output data while keeping default ONNX operator output unchanged

Validation

  • uv run pytest tests/unit/optim/test_analysis.py tests/unit/commands/test_optimize_cli.py tests/unit/analyze/test_optim_output.py
  • uv run ruff check --fix src/winml/modelkit/optim/analysis.py src/winml/modelkit/analyze/optim_output.py tests/unit/optim/test_analysis.py tests/unit/commands/test_optimize_cli.py tests/unit/analyze/test_optim_output.py

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@xieofxie
xieofxie requested a review from a team as a code owner August 13, 2026 02:54

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.

Reviewed the domain propagation through graph collection, diff reporting, CLI rendering, structured optimization output, and produced-operator support. The implementation is backward compatible for default-domain ONNX nodes and all CI checks pass. No blocking findings.

outputs: tuple[str, ...]
domain: str = ""

def qualified_op_type(self) -> str:

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.

Centralizing qualification here keeps label(), histograms, and support output consistent. Treating both the empty domain and ai.onnx as default preserves existing output while custom domains become unambiguous.

table[key] = (
node.SerializeToString(),
NodeRef(node.op_type, node.name, tuple(node.output)),
NodeRef(node.op_type, node.name, tuple(node.output), node.domain),

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 to capture node.domain at collection time rather than trying to recover it later from display strings. The added field has a default, so existing NodeRef(op_type, name, outputs) callers remain source-compatible.

"name": ref.name,
"outputs": list(ref.outputs),
}
if ref.domain and ref.domain != "ai.onnx":

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.

Keeping op_type raw and adding domain only for custom-domain nodes is a clean structured representation and avoids changing the JSON shape for ordinary ONNX operators. Non-blocking coverage suggestion: add an explicit ai.onnx serialization assertion so this backward-compatibility rule is locked down in to_dict() as well as in label().

result.operators.append(
ProducedOperatorSupport(
op_type=ref.op_type,
op_type=ref.qualified_op_type(),

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.

This qualification happens only after support has been correlated by output tensor, so it improves reporting without changing runtime support classification. That separation is important for custom operators and looks correct.

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