Skip to content

Add CGC lowering target options to compile, eval, and perf - #1490

Merged
Zhenchao Ni (zhenchaoni) merged 3 commits into
mainfrom
private/zhenni/cgc_lowering_target
Oct 23, 2026
Merged

Zhenchao Ni (zhenchaoni) merged 3 commits into
mainfrom
private/zhenni/cgc_lowering_target

Conversation

@zhenchaoni

@zhenchaoni Zhenchao Ni (zhenchaoni) commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Add a --cgc-lowering-target auto|dml|d3d12 option to compile, eval, and perf, allowing users to select the CGC lowering target.

  • Forward the option through command configuration to the Windows ML Runtime compiler.
  • Validate that the option is used with the CGC backend.
  • Unify ONNX and MLIR loading on CGC: compile to an output IR artifact, reload it, then build and run the pipeline.
  • Preserve Runtime's Automatic target selection when the option is omitted.

Examples

Benchmark an ONNX model using CGC with DirectML lowering:

winml perf -m model.onnx --runtime winml-runtime --backend cgc --device gpu --cgc-lowering-target dml

Compile CGC Input IR with D3D12 lowering:

winml compile -m model.mlir --compiler cgc --device gpu --cgc-lowering-target d3d12 -o compiled.mlir

@zhenchaoni
Zhenchao Ni (zhenchaoni) requested a review from a team as a code owner October 23, 2026 04:08

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.

One input-validation issue remains before approval. All 538 existing affected tests passed locally; Ruff and git diff --check passed. A focused additional CLI probe reproduced acceptance of --runtime winml-ort --cgc-lowering-target d3d12 (exit 0 and benchmark config retained d3d12), although the non-Runtime model path discards that setting. Native behavior for recompiling existing Output IR was not exercised locally.

Comment thread src/winml/modelkit/models/winml/base.py
@zhenchaoni
Zhenchao Ni (zhenchaoni) force-pushed the private/zhenni/cgc_lowering_target branch from 6f62530 to 5bdb7a7 Compare October 23, 2026 07:46
@zhenchaoni
Zhenchao Ni (zhenchaoni) merged commit 9432f33 into main Oct 23, 2026
9 checks passed
@zhenchaoni
Zhenchao Ni (zhenchaoni) deleted the private/zhenni/cgc_lowering_target branch October 23, 2026 08:05
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