preserve layouts for symbolic shapes through pointwise ops#4923
Open
shivadbhavsar wants to merge 4 commits into
Open
preserve layouts for symbolic shapes through pointwise ops#4923shivadbhavsar wants to merge 4 commits into
shivadbhavsar wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Extends symbolic-shape layout preservation through pointwise-style operators so that elementwise ops behave consistently with static shapes. Previously, fully symbolic dynamic shapes fell through the same path as range-based dynamic shapes, losing their layout/permutation/stride information.
Changes:
unaryandpointwise::remove_broadcastsnow rebuild symbolic outputs viawith_lens(dyn_dims())/shape::from_permutation(type, dyn_dims, perm), matching the static layout rules and existing prior art inbinary.hpp,prefix_scan_op.hpp, andsoftmax.hpp.whereadopts the same symbolic-vs-range-dynamic split asbinary, applying packed/broadcasted layout selection when both value inputs are symbolic and keeping strict equality for mixed dynamic cases.convertandbit_castnow propagatedyn_strides()for symbolic inputs, mirroring how the static path preserves layout.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/include/migraphx/op/unary.hpp | Treat symbolic shapes like static for broadcast removal and with_lens rebuild; range-dynamic still passes through. |
| src/include/migraphx/op/where.hpp | Add symbolic-aware layout selection branches; restrict strict-equality path to non-fully-symbolic dynamic inputs. |
| src/include/migraphx/op/pointwise.hpp | Use symbolic from_permutation for broadcasted symbolic inputs in remove_broadcasts. |
| src/include/migraphx/op/convert.hpp | Preserve symbolic dyn_strides() when only the element type changes. |
| src/include/migraphx/op/bit_cast.hpp | Same symbolic stride preservation as convert. |
| test/op_shape_test.cpp | Add symbolic test coverage for unary, convert, and where (packed, broadcasted, non-packed permutation, range-dyn error). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4923 +/- ##
===========================================
- Coverage 92.66% 92.66% -0.00%
===========================================
Files 588 588
Lines 30412 30421 +9
===========================================
+ Hits 28180 28187 +7
- Misses 2232 2234 +2
🚀 New features to boost your workflow:
|
CharlieL7
approved these changes
Jun 1, 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
Layouts should be preserved for symbolic shapes in elementwise compute shape methods.
Technical Details
Follow same layout rules as static shapes for symbolic shapes for elementwise ops.
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable