Repository navigation
feat(compile): add CGIR to CG Output IR compiler mode - #1467
fangyangci wants to merge 4 commits into
Conversation
Compile existing CGC Input IR through the Windows ML Runtime with explicit input-format, target and compiler selectors. Preserve EPContext defaults and add GPU binding, atomic artifact publication, validation, tests and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Qiong Wu (qiowu) (DingmaomaoBJTU)
left a comment
There was a problem hiding this comment.
I found two validation-path regressions that can reject otherwise valid compiled artifacts; details are inline.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Zhenchao Ni (zhenchaoni)
left a comment
There was a problem hiding this comment.
Requesting changes primarily because CGC compilation needs to use WinMLRuntimeSession, consistent with the existing WinMLSession / WinMLQairtSession convention. The three inline comments cover that architectural requirement, stale metadata on overwrite, and the compiler type-narrowing failure.
ONNX input support for --compiler cgc is not a requirement for this PR and is not a blocker.
Please also keep this change incremental: reconsider whether the additional Foundry pre-parse, text/regex classification, and hash receipt are necessary for exposing Runtime compilation. Preserve necessary resource-companion handling and overwrite safety, but avoid a parallel Runtime compilation implementation. The exporter metadata format change from "cgc-input-ir" to "cgir" appears unrelated to this feature and should preferably be left out unless a direct dependency requires it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Add a CGIR to device-targeted CG Output IR compiler mode to
winml compile, while preserving the existing ONNX-to-EPContext path.--compiler cgcis optional for a single.mliror.mlirbcinput; the CLI infers the CGC compiler from those suffixes. It remains available to select the compiler explicitly or for CGIR files with another suffix.WinMLRuntimeSession.compile_to_file()API.--device-luidbinding when needed, without requiring an ORT execution provider.ModelCompiler.compile_to_file()withCompiledModelForm.DEVICE_TARGETED.Output and validation semantics
The output is MLIR bytecode, including when the filename uses
.mlir;.mlirbcis also accepted. This change does not add a text-dump option.Default validation reloads the output, builds a Runtime pipeline, and compares I/O schemas through the existing stage-schema compatibility helper. Dynamic dimensions reported as either
0orUINT64_MAXare normalized before comparison. Validation does not run inference, certify numerical accuracy, or execute a benchmark.--no-validateskips that reload/build check, not compilation.The new mode currently supports GPU only. Existing
ort,ort_session, andqairtcompilation behavior remains unchanged. A compatible preview Windows ML Runtime is required.Verification
mypy -p winml.modelkitpassed for all 464 source files.windowsml 2.8.75.dev0,onnxruntime-windowsml 1.30.0.202609102321, and NVIDIA GeForce RTX 5070.No model weights, benchmark reports/results, or local runtime packages are included in this PR.