Integrate CGIR workflow (export, perf, eval) into winml-cli - #1426
Conversation
Squash nine CGC commits from winml-cli-mirror, from ce58e98f391b2bc6a755b888b45f8277a2c9a9be through 49d67c2 (inclusive). Include CGC build/config integration, compatibility rewrites, adapter selection, Foundry ABI updates, Runtime output requests, documentation, and unit tests.
Qiong Wu (qiowu) (DingmaomaoBJTU)
left a comment
There was a problem hiding this comment.
CI follow-ups for the reviewed commit. These comments identify failing checks and test updates; they do not assert a demonstrated production inference regression.
Qiong Wu (qiowu) (DingmaomaoBJTU)
left a comment
There was a problem hiding this comment.
Reviewed this integration in the context of the earlier mirror PR review, including the retained adapter/scalar/error-handling fixes, added CGC constant/DQ/GridSample/Identity rewrites, exporter publication rollback, and Runtime/build/eval routing. No blocking findings identified. All reported PR CI checks pass and git diff --check passed. Seven Foundry-binding tests passed locally in an isolated harness (two missing pytest-timeout configuration warnings). The broader local exporter/runtime test attempts could not collect under that minimal harness because package exports/native dependencies were not available; those attempts are not counted as passing. Native Windows ML/Foundry inference, rewrite numerical suites and the full unit suite were not rerun locally.
Summary
Integrates CGIR export, configuration, build, compilation, performance measurement, and output comparison into WinML CLI.
Three inference workflows are supported:
Examples below use ResNet50 and the installed preview Runtime/EP packages.
--no-syncpreserves those packages in the local environment.Export ONNX and CGIR
Performance: Three Inference Workflows
perfdefaults to automatic runtime selection: MLIR selectswinml-runtime; ONNX selectswinml-ort. Explicit runtime selection remains available. Withwinml-runtime, ONNX defaults to the CGC backend.Compare Against the Original ONNX
Use ORT CPU as the reference and compare the outputs from each workflow. These examples use one sample for a quick check; increase
--samplesfor broader coverage.Compile a WinMLCG EPContext Model
Generate Configs and Build
--backend cgcprepares the model and converts it to CGIR.--ep winmlcgprepares ONNX for the WinMLCG EP without adding CGIR conversion. Use one selector, not both.These configurations apply CGC compatibility rules and default FP16 preparation. Use
--no-quantto preserve the existing ONNX precision, and--rebuildto regenerate existing build artifacts. Review output accuracy, particularly when lossy compatibility rules such as cubic-to-linear Resize are applied.Standalone Compatibility Optimization
Compatibility rules can also be selected individually before export or inference:
Select a Specific GPU
Runtime CGC fails explicitly if the selected adapter cannot be resolved; it does not silently switch to another GPU.