Repository navigation
Fold SplitToSequence when split input is omitted - #3061
Merged
G. Ramalingam (gramalingam) merged 1 commit intoOct 7, 2026
Merged
G. Ramalingam (gramalingam) merged 1 commit into
G. Ramalingam (gramalingam) merged 1 commit into
Conversation
Copilot started reviewing on behalf of
G. Ramalingam (gramalingam)
October 5, 2026 23:11
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation handles the required edge cases and is supported by comprehensive regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Enables constant folding of SplitToSequence when its optional split input is omitted.
Changes:
- Treats omitted splits as scalar-one chunks for opset 18+.
- Guards zero-length axes and adds rewrite/control tests.
| File | Description |
|---|---|
onnxscript/optimizer/_constant_folding.py |
Implements omitted-split lowering and safety guards. |
onnxscript/optimizer/_constant_folding_test.py |
Tests semantics and non-rewrite conditions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
G. Ramalingam (gramalingam)
approved these changes
Oct 7, 2026
G. Ramalingam (gramalingam)
enabled auto-merge (squash)
October 7, 2026 00:02
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3061 +/- ##
==========================================
+ Coverage 72.73% 72.79% +0.05%
==========================================
Files 265 265
Lines 32358 32392 +34
Branches 3069 3074 +5
==========================================
+ Hits 23536 23580 +44
+ Misses 7779 7774 -5
+ Partials 1043 1038 -5 ☔ View full report in Codecov by Harness. |
G. Ramalingam (gramalingam)
merged commit Oct 7, 2026
daf4fbb
into
microsoft:main
26 of 32 checks passed
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.
Fixes #3057.
The constant folder returns early when
SplitToSequencehas nosplitinput, even when the split-axis size is known. This prevents lowering it toSplitand resolving downstreamSequenceAtnodes.Following the approach described in the issue, this treats an omitted
splitas chunks of size one and reuses the existing scalar lowering, includingSqueezeforkeepdims=0. An explicit empty optional-input slot is handled the same way.The new path requires an opset 18+ import on the node's graph or function, since it uses
Split.num_outputs. Older opsets, control-flow subgraphs without their own imports, and dynamic axis sizes remain unchanged. A zero-length axis is also left alone rather than creating an invalid zero-outputSplit; that guard applies to explicit scalar splits too.Tests
keepdimsvalues, and omitted versus empty-name inputs. Each compares original and optimized ONNX reference execution with NumPy and checks the optimized graph's validity.lintrunner -aon both changed files passes.No full-repository test run or runtime speedup is claimed.