Skip to content

[Fix][Relax][ONNX] Keep anonymous dimensions independent - #20988

Open
DiadkoShmek wants to merge 1 commit into
apache:mainfrom
DiadkoShmek:DiadkoShmek/fix-onnx-anonymous-dimensions
Open

DiadkoShmek wants to merge 1 commit into
apache:mainfrom
DiadkoShmek:DiadkoShmek/fix-onnx-anonymous-dimensions

Conversation

@DiadkoShmek

Copy link
Copy Markdown

Fixes #20867.

When an ONNX input dimension has neither a concrete extent nor a symbolic name, the importer must give that occurrence an independent variable. The existing dimension parser cached the empty name, making unrelated extents compare equal at the Relax VM boundary. It also treated an explicit zero extent as though the field were unset.

Read the protobuf field presence, preserve concrete values including zero, and allocate a fresh variable for each anonymous dimension. Keep the graph-wide map for named dimensions. The regression runs an LLVM-compiled ONNX model with different anonymous extents within and across inputs. It checks that the named batch extent is shared and that zero remains static.

Local validation on 23a6dbe, Linux x86-64, ONNX 1.22.0 and LLVM from TIRx 0.1.0.

  • Both new cases fail at the VM shape check on the base.
  • Both pass with the patch, and the focused shape suite passes 7/7.
  • The broader shape/symbolic/dynamic/identity selection has 143 passes and one skip with the patch. One Range discrepancy against ONNX Runtime 1.29.0 also fails on the base.
  • Ruff lint and formatting pass for both changed files.

Codex assisted with the patch and validation.

This branch has not been deployed

No deployments
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.

[Bug][Relax][ONNX] Independent anonymous dimensions become one shared symbol

1 participant