Merge release/v0.4.0 back into main - #1452
Open
fangyangci wants to merge 7 commits into
Open
fangyangci wants to merge 7 commits into
fangyangci wants to merge 7 commits into
Conversation
## Summary - Add the v0.4.0 CHANGELOG entry from the reviewed monthly release scope. - Bump the package version from 0.3.1 to 0.4.0 without changing runtime dependencies. Targets release/v0.4.0 for the planned 2026-09-24 release. CHANGELOG and version changes are separate commits; the ignored local uv.lock is not included. ## Validation - Configured pre-commit checks passed for both files. - uv lock --check passed using the approved index, and uv version reports 0.4.0. - Release-note PR references and git diff --check passed. Final release E2E, model gates, official-wheel smoke, and publication approvals remain separate.
## Summary Remove two CGC compatibility workarounds following upstream IX fixes already included in the current compiler version (`35c01c26`). | Removed workaround | Upstream issue | Fix | |---|---|---| | `eliminate-identity` | microsoft/ix#1198 — ONNX Identity fails to lower to Foundry and DXCGC | microsoft/ix#1201 adds native Identity lowering. | | Pad-specific constant folding (`fold_constant_pad_pads`) and the `fold-constant-pad-pads` compatibility alias | microsoft/ix#1199 — Support constant folding of ONNX Pad parameters before lowering | microsoft/ix#1206 improves Cast/Pad chain support, static shape inference, and lowering type compatibility. | ## Changes - Remove the Identity rewrite implementation, capability registration, and public export. - Remove the Pad-specific folding prepass and its dedicated dead-producer cleanup. - Remove the `fold-constant-pad-pads` alias and public function export. - Update documentation and tests to reflect the retired rules. - Preserve `cgc-constant-folding` and its shared integer/boolean expression evaluator. General folding remains necessary for static shape chains and continues to fold Pad parameters in graphs containing `Shape`. - Leave compiler options, including the default-enabled topological sorting, unchanged. ## Validation - 203 affected unit tests passed. - All five models that previously used the Pad-specific prepass retained identical Pad parameter values. - GPU outputs before and after Pad-prepass removal were elementwise identical across three input samples per model. - The three SOD models required topological sorting to be disabled for the GPU comparison because the current wheel does not yet include the fix for microsoft/ix#1207. Their default-path conversion failure remains unchanged. - End-to-end SOD validation through JSON config, build, perf, and eval is still in progress.
Disable topological sorting by default for CGIR conversion to work around microsoft/ix#1207, whose fix is not included in the compiler shipped with the current Windows ML wheel. This avoids conversion failures in the three P1 models and aligns with IX OnnxConverter’s default. Sorting remains available through `topo-sort-nodes=true`.
## Summary - Bundle `analyze/utils/avalizble_ep_device_ops/avaliable_providers.json` in the wheel and source distribution so installed packages can resolve valid EP/device pairs. - Add a packaging regression test that builds the distributions and verifies the JSON is present with the expected contents in both archives. Targets `release/v0.4.0`. No runtime code, dependency, version, or pipeline changes. ## Validation - Focused wheel/sdist regression test: 1 passed on the latest release branch baseline. - Ruff check, Ruff format check, and `git diff --check` passed. A new Official Build and installed-wheel verification are still required after merge. This PR does not publish any artifacts.
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: ```python import numpy as np import onnx from onnx import helper as h, TensorProto as T, numpy_helper as nh def tensor(name, dtype, shape): return h.make_tensor_value_info(name, dtype, shape) kind = 'dynamic_add' initializers = [] opset = 18 nodes = [h.make_node('Add', ['a', 'b'], ['y'])] inputs = [tensor('a', T.FLOAT, ['batch', 3]), tensor('b', T.FLOAT, ['batch', 3])] outputs = [tensor('y', T.FLOAT, ['batch', 3])] model = h.make_model(h.make_graph(nodes, kind, inputs, outputs, initializers), opset_imports=[h.make_opsetid('', opset)], ir_version=10) onnx.checker.check_model(model) onnx.save(model, kind + '.onnx') ``` ```powershell python ./make_repro.py winml perf -m ./dynamic_add.onnx --runtime winml-runtime --backend cgc --device gpu --iterations 1 --warmup 0 --no-memory --no-monitor $LASTEXITCODE ``` Also run WinMLCG: ```powershell $env:WINMLCLI_EP_PATH = (Resolve-Path .venv/Lib/site-packages/windowsml/lib).Path winml perf -m ./dynamic_add.onnx --runtime winml-ort --ep winmlcg --device gpu --iterations 1 --warmup 0 --no-memory --no-monitor ``` ## 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.
fangyangci
marked this pull request as ready for review
September 23, 2026 08:06
#1454) … declare Two questions get asked on every new machine and after every driver update: which D3D12 adapters are here, and what does this driver's MLIR-program implementation claim it can match. Both are answered through public Windows APIs with ctypes, so nothing has to be built and no extra package installed. winml cgc adapters # which adapters are here winml cgc patterns [-a ADAPTER] [-v] # what a driver declares winml cgc patterns -a ADAPTER --dump [--overwrite] # keep it on disk winml cgc patterns [-a ADAPTER] --open [FILE] # look at a dump Listing adapters needs nothing beyond Windows. Anything touching MLIR patterns needs an Agility SDK D3D12Core.dll of SDK 720 or newer, named by --d3d12-dir or $WINML_D3D12_DIR/$D3D12_DIR, or dropped in bin/ beside the venv or the install; the inbox runtime does not serve the preview feature. Which core answered opens every run on the redist: line, because the same driver reports different things through the 720 and 721 exchange shapes. When none can be found, the MLIR column reads ? rather than no -- the question could not be asked -- and the failure names every place that was searched. With no -a, `patterns` asks every adapter and prints one line each; a driver that claims the exchange and then refuses it costs only its own line, on stderr, and the run exits 1 at the end. A -a number is an index when one exists and otherwise a description substring, so `-a 5060` finds the RTX 5060. A dump is filed under patterns/<adapter-slug>/<driver-version>/ and holds patterns.mlir, metadata.txt (the six keys dxcgc-dump-driver-patterns writes, plus which redist and ABI produced it and how the stored payload differs from the one received) and patterns.json: one record per pattern -- index, name, kind, benefit, rule count, source file, kernel, line count and its own text -- plus a summary, per-kind and per-source grouping and a format tag, so nothing downstream has to parse MLIR. Text payloads are normalised once, where the exchange returns them: the trailing NUL is dropped and every line break becomes LF, so the counts, patterns.mlir and patterns.json describe the same bytes. Bytecode is left alone. Counting treats a pattern as one cgc_pattern.pattern declaration and a rule as one flat match alternative after any_of expansion, because comparing declaration counts alone across drivers can read a loss where the matching surface grew. Comments are blanked rather than deleted so offsets stay valid, the displayed text keeps its comments, and a brace inside a comment cannot unbalance a slice. --open shows a dump in the CGC Pattern Atlas, a self-contained page that ships inside the package and is resolved with importlib.resources, so it works from a wheel, an editable install and a checkout alike. A dump is embedded into a copy of the page named after it, with every "<" escaped so a pattern's own text cannot close the script element. --open FILE shows a dump taken earlier and asks no driver anything; anything that is not a patterns.json is a usage error. Verified on an RTX 5060 (driver 32.0.16.3004), an AMD 880M and WARP against the SDK 720 and 721 redists in DXCGC-Drop10.0-x64 and against Drop11: 51 patterns / 63 rules on the 720 path, byte-identical dumps across refactors, and the documented exit codes on every failure path. docs/commands/cgc.md covers both commands, every flag and scenario, the dump layout and patterns.json. TODO(tests) markers record the gaps left untested.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merge the
release/v0.4.0branch back intomainafter the v0.4.0 release.