Skip to content

support symbolic shape transpose, contiguous, as_shape#4823

Open
shivadbhavsar wants to merge 94 commits intoto_symbolic_helperfrom
sym_layout_ops
Open

support symbolic shape transpose, contiguous, as_shape#4823
shivadbhavsar wants to merge 94 commits intoto_symbolic_helperfrom
sym_layout_ops

Conversation

@shivadbhavsar
Copy link
Copy Markdown
Contributor

Motivation

Propagate symbolic shapes through transpose, contiguous and as_shape

Technical Details

Changelog Category

Add a CHANGELOG.md entry for any option other than Not Applicable

    • Added: New functionality.
    • Changed: Changes to existing functionality.
    • Removed: Functionality or support that has been removed. (Compared to a previous release)
    • Optimized: Component performance that has been optimized or improved.
    • Resolved Issues: Known issues from a previous version that have been resolved.
    • Not Applicable: This PR is not to be included in the changelog.

@shivadbhavsar shivadbhavsar changed the title support transpose, contiguous, as_shape support symbolic shape transpose, contiguous, as_shape Apr 24, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

❌ Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/include/migraphx/op/as_shape.hpp 50.00% 4 Missing ⚠️
src/shape.cpp 80.00% 1 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           to_symbolic_helper    #4823      +/-   ##
======================================================
+ Coverage               92.52%   92.52%   +0.01%     
======================================================
  Files                     583      583              
  Lines                   29967    29975       +8     
======================================================
+ Hits                    27724    27734      +10     
+ Misses                   2243     2241       -2     
Files with missing lines Coverage Δ
src/include/migraphx/op/contiguous.hpp 93.33% <100.00%> (-0.42%) ⬇️
src/include/migraphx/op/transpose.hpp 100.00% <100.00%> (ø)
src/include/migraphx/shape.hpp 91.36% <ø> (ø)
src/include/migraphx/sym.hpp 100.00% <ø> (ø)
src/shape.cpp 91.84% <80.00%> (+0.06%) ⬆️
src/include/migraphx/op/as_shape.hpp 66.67% <50.00%> (+30.30%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from sym_dim_integration to develop April 25, 2026 21:06
@shivadbhavsar shivadbhavsar marked this pull request as ready for review April 26, 2026 04:46
@shivadbhavsar shivadbhavsar requested a review from causten as a code owner April 26, 2026 04:46
Copilot AI review requested due to automatic review settings April 26, 2026 04:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds symbolic-shape support so shape propagation can pass through transpose, contiguous, and as_shape without dropping symbolic dimension/stride information, by extending shape with a symbolic element-count helper.

Changes:

  • Add shape::sym_elements() to compute element count as a sym::expr for static/symbolic shapes.
  • Update transpose and contiguous shape inference to correctly handle symbolic shapes (including symbolic strides).
  • Update as_shape to accept symbolic shapes and use dyn_output in compute.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/op_shape_test.cpp Adds new shape-propagation tests for symbolic transpose, contiguous, and as_shape.
src/shape.cpp Implements shape_impl::sym_elements() and shape::sym_elements().
src/include/migraphx/shape.hpp Declares shape::sym_elements() API.
src/include/migraphx/sym.hpp Adds <type_traits> include for sym utilities.
src/include/migraphx/op/transpose.hpp Preserves symbolic dims/strides through transpose; keeps range-only dynamic as dims-only permutation.
src/include/migraphx/op/contiguous.hpp Ensures dynamic (incl. symbolic) outputs are returned as standard/packed shapes.
src/include/migraphx/op/as_shape.hpp Allows symbolic shapes, adds explicit rejection for range-only dynamic shapes, and switches compute to dyn_output.

Comment thread src/include/migraphx/op/as_shape.hpp
Comment thread src/include/migraphx/op/as_shape.hpp Outdated
Comment thread test/op_shape_test.cpp
@shivadbhavsar shivadbhavsar changed the base branch from develop to to_symbolic_helper April 29, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants