[SWDEV-587978] Fix simplify reshapes error for thm models#4894
Open
urpetkov-amd wants to merge 6 commits into
Open
[SWDEV-587978] Fix simplify reshapes error for thm models#4894urpetkov-amd wants to merge 6 commits into
urpetkov-amd wants to merge 6 commits into
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
pfultz2
reviewed
May 19, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4894 +/- ##
========================================
Coverage 92.88% 92.88%
========================================
Files 587 587
Lines 30331 30335 +4
========================================
+ Hits 28170 28174 +4
Misses 2161 2161
🚀 New features to boost your workflow:
|
TedThemistokleous
approved these changes
May 21, 2026
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.
Motivation
Compiling certain optical-flow models on GPU fails inside
simplify_reshapeswith:This affects models where
find_gatherrewrites agatherwhose output is later expanded by amultibroadcaston the same axis the slice operates on. The existing axis-multiplicity guard infind_slice_shape_transforms(added in #4728 for claa models) does not catch this case.Technical Details
In
find_slice_shape_transforms::apply, afterdesc.rebase(slice.in.lens)the rebased descriptor can silently absorb a1 → Nmultibroadcast on the sliced axis (because the slice input is no longer singleton on that axis). The pass then emits a slice with the wrong output shape and the next pointwise op fails itssame_dimscheck.Added one extra invariant in the same guard style as the existing check: for each sliced axis the rebased dst-axis length must scale by
slice_input_len / slice_output_lenrelative to the originalinsoutput length. If it does not, the rewrite would change the output shape, so we bail to the existing safe path that is already used for the axis-split case.Added regression test
TEST_CASE(slice_multibroadcast_over_sliced_axis)intest/simplify_reshapes_test.cppthat reproduces the exact pattern produced byfind_gatheron the affected model and assertsget_output_shapesis preserved. Complements the existingslice_reshape_multibroadcast_rebase_axistest from #4728 which covers the orthogonal "axis split" case.Changelog Category