Repository navigation
Conversation
against reversed stride order
Co-authored-by: Cursor <cursoragent@cursor.com>
CharlieL7
marked this pull request as ready for review
October 14, 2026 21:57
CharlieL7
requested review from
TedThemistokleous and
kahmed10
and
a balanced review from Copilot
October 14, 2026 21:57
Comment on lines
+68
to
+72
| auto result = migraphx::verify_args( | ||
| "empty shape mismatch", | ||
| migraphx::argument{target_shape, nullptr}, | ||
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | ||
| migraphx::verify::tolerance{1e-3}); |
Contributor
There was a problem hiding this comment.
[format.py] reported by reviewdog 🐶
Suggested change
| auto result = migraphx::verify_args( | |
| "empty shape mismatch", | |
| migraphx::argument{target_shape, nullptr}, | |
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | |
| migraphx::verify::tolerance{1e-3}); | |
| auto result = | |
| migraphx::verify_args("empty shape mismatch", | |
| migraphx::argument{target_shape, nullptr}, | |
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | |
| migraphx::verify::tolerance{1e-3}); |
Comment on lines
+82
to
+86
| auto result = migraphx::verify_args( | ||
| "empty type mismatch", | ||
| migraphx::argument{target_shape, nullptr}, | ||
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | ||
| migraphx::verify::tolerance{1e-3}); |
Contributor
There was a problem hiding this comment.
[format.py] reported by reviewdog 🐶
Suggested change
| auto result = migraphx::verify_args( | |
| "empty type mismatch", | |
| migraphx::argument{target_shape, nullptr}, | |
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | |
| migraphx::verify::tolerance{1e-3}); | |
| auto result = | |
| migraphx::verify_args("empty type mismatch", | |
| migraphx::argument{target_shape, nullptr}, | |
| migraphx::verify::expected{migraphx::argument{ref_shape, nullptr}}, | |
| migraphx::verify::tolerance{1e-3}); |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues include a debug assertion failure, incorrect compound-symbolic permutation rejection, and unwritten verification error output.
3 open findings
What changed in this PR
Improves MIGraphX handling of zero-element tensors produced by data-dependent operators.
Changes:
- Updates broadcasting, reshape execution, and gather simplification for empty tensors.
- Adjusts symbolic permutation checks and empty-argument verification.
- Adds regression tests for these behaviors.
| File | Description |
|---|---|
| test/verify_args.cpp | Tests empty-argument comparisons. |
| test/simplify_reshapes_test.cpp | Adds a zero-output gather regression. |
| test/shape_test.cpp | Tests symbolic zero-extent permutations. |
| test/ref/reshape.cpp | Tests empty reshape execution. |
| test/ref/multibroadcast.cpp | Tests empty broadcasting execution. |
| test/op_shape_test.cpp | Tests zero-extent shape inference. |
| src/verify_args.cpp | Adds shape-based empty comparisons. |
| src/simplify_reshapes.cpp | Guards empty gather indices. |
| src/permutation.cpp | Restricts ordering checks to nonempty layouts. |
| src/include/migraphx/op/reshape.hpp | Short-circuits empty reshape copies. |
| src/common.cpp | Preserves zero extents during broadcasting. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+75
to
+76
| else if(sym::to<int64_t>(bounds.min) == 0) | ||
| nonzero_dim_bounds.emplace(dd.sym_expr, sym::interval{int64_t{1}, bounds.max}); |
Comment on lines
+1450
to
+1451
| if(indices.empty()) | ||
| return std::nullopt; |
Comment on lines
+79
to
+80
| if(auto empty_result = verify_empty_args(name, t_arg, r_arg)) | ||
| return *empty_result; |
This branch has not been deployed
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
Technical Details
reshapefor zero tensor.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot ApplicableFollow the LLVM AI Tool Use Policy for contributions using AI.