Skip to content

Update find_concat_same_inputs to handle dimension > 1 - #5142

Open
pfultz2 wants to merge 2 commits into
developfrom
concat-same-inputs-non-zero
Open

Update find_concat_same_inputs to handle dimension > 1#5142
pfultz2 wants to merge 2 commits into
developfrom
concat-same-inputs-non-zero

Conversation

@pfultz2

@pfultz2 pfultz2 commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Motivation

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.

Follow the LLVM AI Tool Use Policy for contributions using AI.

@pfultz2
pfultz2 requested a review from causten as a code owner August 16, 2026 21:22
Copilot AI lite review requested due to automatic review settings August 16, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends simplify_algebra’s find_concat_same_input rewrite so it can simplify concat(x, x, ..., x) not only when the concatenation axis has length 1, but also when the axis length is > 1 (by rewriting to an unsqueeze + multibroadcast + reshape “tile” sequence). Corresponding unit tests are updated and expanded to cover additional axes and tiling cases.

Changes:

  • Update find_concat_same_input to handle lens[axis] > 1 using unsqueezemultibroadcastreshape.
  • Update existing dot/concat simplification expectations to match the new rewrite.
  • Add new test cases for tiling along axis 0 and axis 1 (including non-last-axis scenarios).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/simplify_algebra.cpp Generalizes concat(same input) simplification to support axis length > 1 via tiling sequence.
test/simplify_algebra_test.cpp Updates prior expectations and adds coverage for the new tiling rewrite across multiple axes.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/simplify_algebra.cpp
Comment on lines 1114 to 1118
auto axis = ins->get_operator().to_value()["axis"].to<int64_t>();
const auto& lens = x->get_shape().lens();

if(axis < 0 or axis >= lens.size())
return;
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5142   +/-   ##
========================================
  Coverage    93.12%   93.12%           
========================================
  Files          625      625           
  Lines        33162    33168    +6     
========================================
+ Hits         30879    30885    +6     
  Misses        2283     2283           
Files with missing lines Coverage Δ
src/simplify_algebra.cpp 97.54% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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