You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 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.
Copy file name to clipboardExpand all lines: docs/commands/optimize.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -135,10 +135,9 @@ the shared pattern package does not re-export these backend-specific patterns.
135
135
|------------|--------------------------|
136
136
|`normalize-int32-dq`| Normalize initializer-backed INT32 `DequantizeLinear` in the standard domain (opset >= 10) and `com.microsoft` (opset 1): omit immutable all-zero scalar/singleton zero points and clone singleton scales as scalars. Preserve shared initializers and domains; skip overridable parameters, per-axis vectors, unsupported attributes and nonlocal inputs. Handles nested graphs, not local functions. Enabled by CGC build configuration, disabled by default elsewhere. |
137
137
|`deduplicate-opset-imports`| Remove repeated model-level opset declarations with identical domain and version, retaining the first declaration and domain order. Reject conflicting versions for the same domain. Run before operator rewrites and opset upgrades; do not alter graph content, local functions, or the retained versions. |
138
-
|`eliminate-identity`| Remove safe internal tensor Identity aliases. Additionally replace top-level standard-domain FP32 graph-output Identities with same-shape Reshape when input/output types match exactly, all dimensions are positive static integers, opset >= 5, and the model has no subgraphs. Preserve output names/order, annotated aliases, unknown or conflicting types, scalar/dynamic/zero-size outputs and protected captures. Does not rewrite local functions. Workaround for [microsoft/ix#1198](https://github.com/microsoft/ix/issues/1198). |
139
138
|`gridsample-to-gather`| Decompose 2D `GridSample` with linear interpolation and zero padding into four `GatherND` reads, bounds masks and weighted sums. Supports both `align_corners` settings, FP16/FP32 IO and dynamic batch, with known positive channel, input spatial and grid spatial dimensions. Rank-3 indices contain explicit batch and spatial coordinates; `batch_dims=0` avoids the ORT symbolic shape inference defect tracked in [onnxruntime#24206](https://github.com/microsoft/onnxruntime/pull/24206). Batch coordinates are generated dynamically and shared across the four reads; sampled values are reshaped back to the grid layout. FP16 interpolation is computed in FP32 and cast back. Requires opset >= 16 (`bilinear` before opset 20); other modes are unchanged. Enabled by CGC builds, disabled in ordinary optimization. Floating-point rounding may differ from native sampling. |
140
139
|`omit-empty-resize-inputs`| Replace statically empty Resize ROI/scales with omitted inputs. Do not rely on graph-input defaults or rewrite crop-and-resize semantics. Requires opset 13; upgrade older matching models using ONNX version conversion. |
141
-
| `cgc-constant-folding` | Fill FoundryToolbox constant-folding gaps without an ORT Session. Fold standard `Pad.pads` constant integer chains; in graphs containing `Shape`, also fold statically known selected dimensions and bounded constant integer/boolean expressions (`Gather`, `Concat`, `Reshape`, `Slice`, `Transpose`, `Squeeze`, `Unsqueeze`, integer `Cast`, `ConstantOfShape`, arithmetic, `Equal`, `Where`). Iterate with shape inference, up to 32 rounds. Requires opset >= 11. Only the main graph is rewritten; preserve tensor names for shared uses and subgraph captures. Runtime floating-point computations and unresolved dimensions remain unchanged. This rule does not freeze inputs: specialize dimensions before optimization when needed; later Foundry `freeze-dims` does not retroactively affect this rule. Limits: 128 dependency values per traversal, 65,536 elements per operation and 1,048,576 cached elements per round. Enabled by CGC builds; disabled in ordinary optimization. `fold-constant-pad-pads` remains a compatibility alias. |
140
+
|`cgc-constant-folding`| Fill FoundryToolbox constant-folding gaps without an ORT Session. In graphs containing `Shape`, fold statically known selected dimensions and bounded constant integer/boolean expressions (`Gather`, `Concat`, `Reshape`, `Slice`, `Transpose`, `Squeeze`, `Unsqueeze`, integer `Cast`, `ConstantOfShape`, arithmetic, `Equal`, `Where`). Iterate with shape inference, up to 32 rounds. Requires opset >= 11. Only the main graph is rewritten; preserve tensor names for shared uses and subgraph captures. Graphs without `Shape`, runtime floating-point computations and unresolved dimensions remain unchanged. This rule does not freeze inputs: specialize dimensions before optimization when needed; later Foundry `freeze-dims` does not retroactively affect this rule. Limits: 128 dependency values per traversal, 65,536 elements per operation and 1,048,576 cached elements per round. Enabled by CGC builds; disabled in ordinary optimization. |
142
141
|`resize-tf-half-pixel-for-nn-to-asymmetric`| Change only the coordinate mode for nearest/floor Resize with static, non-overridable, positive integer scales. Dynamic/fractional scales and sizes-based inference are outside this rule. |
143
142
|`approximate-cubic-resize-with-linear`|**Lossy**, explicit cubic-to-linear approximation. Excludes antialiasing, outside exclusion, and crop-and-resize semantics. Prints a warning when applied. |
144
143
|`gathernd-to-reshape`| Replace GatherND only when data/indices/output ranks are not all equal and static, non-overridable int64 indices visit every input slice exactly once in storage order. Require positive static data dimensions; support batch dimensions, multi-coordinate indices, and equivalent negative indices. Dynamic data shapes or indices, overridable defaults, empty tensors, partial selection, repetition, and reordering are outside this rule. |
0 commit comments