Repository navigation
[FIX][ONNX] Preserve scalar SplitToSequence chunk boundaries - #21134
Open
shpetimhaxhiu wants to merge 1 commit into
Open
shpetimhaxhiu wants to merge 1 commit into
shpetimhaxhiu wants to merge 1 commit into
Conversation
Use explicit split indices when a scalar chunk size leaves a remainder. Keep equal sections for divisible sizes. Reported-by: tangyixuan01 (apache#21132) Generated-by: OpenAI Codex (GPT-6)
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.
Fixes #21132. Thanks to @tangyixuan01 for isolating the scalar and vector forms and identifying the incorrect lowering.
ONNX uses a scalar split input as the chunk size. Relax interprets an integer split argument as the number of equal sections. For a six-element input and scalar split of four, the old lowering emitted two sections of length three and put element 3 in the second chunk.
This change emits cut positions at multiples of the chunk size for an uneven split and keeps equal sections for divisible sizes. The regression test checks the expected Relax IR for a 4 + 2 split and a separate split with two cut positions. A Windows x64 LLVM comparison using the published 0.27.0.post1 wheel with this converter change checks shapes and values against ONNX Runtime for nine synthetic cases, including negative axes, an explicit vector, and default and even splits.
The current checkout also built successfully with MSVC and the Apache TIRx LLVM target on Windows x64. The unmodified frontend failed the three uneven cases. The patched checkout passed the nine value comparisons, two invalid-input checks, and all four repository SplitToSequence tests.
OpenAI Codex assisted with the implementation and validation.