Fix dynamic shape conversion semantics #4828
Open
shivadbhavsar wants to merge 5 commits intodevelopfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines MIGraphX shape conversion semantics after symbolic shape integration, clarifying when shapes should be represented as range-based dynamic vs symbolic dynamic and adding utilities to enforce a uniform representation.
Changes:
- Reworked
shape::to_dynamic()to return a range-based dynamic shape (and demote symbolic shapes by evaluating intervals/optimals), restoring pre-symbolic semantics. - Added
shape::to_symbolic()andstatic shape::to_dynamic(std::vector<shape>)to promote/demote shapes to a uniform representation across inputs (including tuple sub-shapes). - Extended shape tests for
to_symbolic, staticto_dynamic,same_lenswith symbolic shapes, andis_fixed().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/shape.cpp |
Implements updated to_dynamic(), adds to_symbolic(), adds static to_dynamic(vector), and updates same_lens() via new is_fixed(). |
src/include/migraphx/shape.hpp |
Declares new conversion APIs and adds fixed-dim utilities plus is_fixed() declaration. |
test/shape_test.cpp |
Updates existing expectations and adds coverage for symbolic promotion/demotion and fixed/same-lens behaviors. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4828 +/- ##
===========================================
- Coverage 92.80% 92.79% -0.00%
===========================================
Files 584 584
Lines 30067 30111 +44
===========================================
+ Hits 27901 27941 +40
- Misses 2166 2170 +4
🚀 New features to boost your workflow:
|
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
Goal here is to fix the discrepancies left after integrating symbolic shapes.
Technical Details
In practice, there should be no mix between range-based dynamic shapes and symbolic shapes (all dynamic shapes will be represented throughout a model exclusively in one format), the goal here is to have a clear semantic anyway. The static to_dynamic function should be used in compute shapes to create a uniform representation in compute_shape methods of operators.
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable