Skip to content

Cherry pick cgir fixes to main - #1435

Merged
Zhenchao Ni (zhenchaoni) merged 2 commits into
mainfrom
cherry-pick/cgir-fixes-to-main
Sep 22, 2026
Merged

Zhenchao Ni (zhenchaoni) merged 2 commits into
mainfrom
cherry-pick/cgir-fixes-to-main

Conversation

@zhenchaoni

Copy link
Copy Markdown
Member

Summary

Cherry-pick #1432 and #1434 from release/v0.4.0 onto main.

  • Remove the obsolete Identity rewrite and Pad-specific constant-folding workaround following upstream compiler fixes.
  • Preserve general CGC constant folding and its shared integer/boolean expression evaluator.
  • 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.
  • Keep topological sorting available through topo-sort-nodes=true.
  • Update the related documentation and tests.

Source commits

Both commits were cherry-picked without conflicts, with source commit references preserved.

Validation

  • 212 tests passed across the affected CGIR rewrite and export command test modules.
  • Ruff checks passed for the affected Python files.
  • git diff --check passed.

## 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.

(cherry picked from commit 855fe5c)
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`.

(cherry picked from commit ff977dd)
@zhenchaoni
Zhenchao Ni (zhenchaoni) requested a review from a team as a code owner September 22, 2026 06:23
@zhenchaoni
Zhenchao Ni (zhenchaoni) merged commit 73056be into main Sep 22, 2026
9 checks passed
@zhenchaoni
Zhenchao Ni (zhenchaoni) deleted the cherry-pick/cgir-fixes-to-main branch September 22, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants