Sym concat slice#4896
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends MIGraphX’s shape inference for slice, concat, and step to work with symbolic shapes (and improves some dynamic-shape behavior), so these ops can participate correctly in symbolic compute_shape flows.
Changes:
- Update
slice1-argnormalize_compute_shapeto support symbolic shapes (while keeping the existing restriction that sliced symbolic axes must be fixed) and to preserve non-sliced dynamic dimension metadata. - Update
stepto compute symbolic output dims/strides (including symbolic stride scaling) and switch evaluation to usedyn_output. - Update
concatto unify static/range-dynamic/symbolic shape inference and support symbolic concatenation along the concat axis. - Add extensive shape tests for symbolic and dynamic behavior across
slice,step, andconcat.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/op_shape_test.cpp | Adds coverage for symbolic and dynamic shape inference for slice, step, and concat (including stride/permutation preservation checks). |
| src/include/migraphx/op/step.hpp | Enables symbolic/dynamic compute_shape for step, computes symbolic dims/strides, and uses dyn_output for runtime shape handling. |
| src/include/migraphx/op/slice.hpp | Improves 1-arg slice dynamic handling (preserve metadata on untouched dims) and adds symbolic-shape support with fixed-axis restriction. |
| src/include/migraphx/op/concat.hpp | Reworks concat shape inference to operate on a unified dynamic/symbolic representation and support symbolic concat-axis sizing. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4896 +/- ##
========================================
Coverage 92.88% 92.88%
========================================
Files 587 587
Lines 30331 30333 +2
========================================
+ Hits 28170 28172 +2
Misses 2161 2161
🚀 New features to boost your workflow:
|
| check_shapes{inputs, *this, true}.has(1, 2, 3, 4); | ||
| if(inputs.size() == 1) | ||
| if(inputs.size() != 1) | ||
| return compute_two_or_more(inputs); |
There was a problem hiding this comment.
Not yet handling the 2+ slice input versions, right?
There was a problem hiding this comment.
ya, not handling true runtime computed shapes using symbolics yet.
| const migraphx::shape& sym_out) { | ||
| EXPECT(sym_out.to_static(sym_map) == op.compute_shape({sin.to_static(sym_map)})); | ||
| }; | ||
|
|
There was a problem hiding this comment.
This doesn't support slicing a symbolic dimension?
There was a problem hiding this comment.
Not yet because that will require upgrading the attributes to allow symbolics
Motivation
Update the slice, concat, and step ops to support symbolic compute shape.
Technical Details
The support for slice is currently limited to fixed dimensions same as the current range-based implementation supported. It can be enhanced once we have a dim-like variant (introduced with the reshape op) that can be used for slices also.
Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable