fix(perf): bind concrete CGC input shapes before compilation - #1433
Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 3 commits into
Conversation
|
Reviewed head The core fix works, but the new pre-compilation validation introduces three reproducible compatibility regressions. I recommend addressing the two P2 findings before merging. I did not find an additional confirmed P0/P1 issue in the reviewed paths. 1. [P2] Do not reject an otherwise executable graph just because an unused input has an anonymous axisruntime_session.py, lines 278-282 Minimal ONNX graph (opset 18, IR version 10, float32): Supply an NPZ with all three input keys, each containing a winml perf -m .\model.onnx --runtime winml-ort --ep winmlcg --device gpu --input-data .\inputs.npz --iterations 1 --warmup 0 --no-memory --no-monitorBase: exits 0. PR: exits 1 before session creation: I understand that this PR intentionally does not add anonymous-axis binding. However, this example does not require that capability: the actual computation already has concrete shapes. Not being able to bind an axis by name is not sufficient evidence that the graph cannot execute. The new blanket rejection narrows the set of previously working models. Please preserve named overrides without unconditionally rejecting every anonymous source axis, or otherwise distinguish axes that actually require specialization for the lowered computation. This should not silently invent names or guess extents. 2. [P2] The positive-extent restriction must not reject a matching static zero dimensionruntime_session.py, lines 271-277 Use the same graph/command, but declare the unused Base: exits 0. PR: exits 1: The static zero axis exactly matches the ONNX declaration. Only This reproduction establishes a regression for the unused-input case; it does not claim that every CGC operator supports empty tensors. 3. [P3] Preserve the existing loader's support for NPY v3 entries inside NPZUse the same graph with unused Base: exits 0; the existing These are ordinary float32 arrays, not object/pickled arrays. Please support v3 headers without allocating the payload, keeping the header reader's accepted formats aligned with the existing loader. The same named-axis fixture with v1 entries succeeds on both revisions. Verification and scope
The first two findings are about preserving previously executable inputs, not a request to implement general dynamic-shape support. Internal data-dependent shapes and full-model/operator coverage remain outside this validation. |
Local ONNX perf compilation can run before concrete input dimensions reach CGC. Resolve shapes from input metadata or CLI defaults and forward them through Runtime compiler options or ORT named-dimension overrides. Provider-discovery changes are excluded.
Windows 11 ARM64 / Adreno X2-90, x64 Python 3.11, WindowsML 2.7.30.dev0 + onnxruntime-windowsml 1.30.0.202609102321. CLI official main 3dd87d3 or PR 1433 at 43d2562. All fixture code is independently authored; no private model, weights, paths or input files are needed.
Minimal synthetic reproduction
Activate the prepared CLI environment with onnx/numpy installed. Save this as make_repro.py:
Also run WinMLCG:
Verified behavior
The 117-byte dynamic Add graph uses CLI default batch=1. No shape file or NPZ is required. Base 3dd87d3: A/E both fail compilation. PR 43d2562: A/E both complete using the identical wheels/model. ONNX ReferenceEvaluator validates the elementary computation. This is a shape-handoff test, not full-model support or accuracy certification.
Review fixes preserve anonymous input axes for compiler handling, accept matching static zero extents, and read NPY v1/v2/v3 headers without loading array payloads. Named-dimension overrides still require positive int64 values. The Runtime session import is now used explicitly to address the CodeQL unused-import finding.
Validation of the review fixes: 197 targeted perf/session/CGC-export tests, repository-wide Ruff, and full-package mypy (464 source files) passed. Regression tests reproduced all three reported failures before the fixes and pass afterward. Native GPU compilation was not rerun for this revision.
Only generated data is included. Private inventory references and full-model details have been removed.