Skip to content

[AIMIGRAPHX-885] Add concat reshape matcher#4984

Merged
causten merged 4 commits into
developfrom
add_concat_reshape_matcher
Jun 25, 2026
Merged

[AIMIGRAPHX-885] Add concat reshape matcher#4984
causten merged 4 commits into
developfrom
add_concat_reshape_matcher

Conversation

@TedThemistokleous

Copy link
Copy Markdown
Collaborator

Motivation

Adds a matcher for the concat_reshape matching. Partial piece when breaking up #4723

Technical Details

Partial changes to allow for MLP batched towers and uses this concat_rehsape matcher

Changelog Category

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

    • [x ] 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.

Handles concat(unsqueeze(x_i, A), ..., axis=A) where the unsqueeze inserts
a new dimension at the concat axis and rewrites it to
reshape(concat(x_i, ..., axis=A)). find_concat_reshape cannot canonicalize
this pattern because its pre/post element-product axis mapping fails when a
unit dimension is inserted exactly at the concat axis.
Covers the concat-axis == unsqueeze-axis case that the existing
concat_unsqueeze test does not exercise (that one is handled by
find_concat_reshape). Fails on develop without the new matcher.
@gh-app-migraphx-bot-pr-write

gh-app-migraphx-bot-pr-write Bot commented Jun 18, 2026

Copy link
Copy Markdown
Test Batch New Rate (ec6867) Old Rate (241f7a) Diff Status
torchvision-resnet50 64 2,872.80 3,158.05 -9.03% 🔴
torchvision-resnet50_fp16 64 6,511.94 6,678.10 -2.49%
torchvision-densenet121 32 2,674.91 2,705.33 -1.12%
torchvision-densenet121_fp16 32 4,515.81 4,480.31 0.79%
torchvision-inceptionv3 32 1,732.55 1,772.37 -2.25%
torchvision-inceptionv3_fp16 32 2,787.70 2,613.31 6.67% 🔆
cadene-inceptionv4 16 824.60 444.89 85.35% 🔆
cadene-resnext64x4 16 780.31 412.50 89.17% 🔆
slim-mobilenet 64 8,387.71 8,419.17 -0.37%
slim-nasnetalarge 64 226.13 nan nan
slim-resnet50v2 64 3,313.76 1,641.82 101.83% 🔆
bert-mrpc-onnx 8 1,173.10 1,165.20 0.68%
bert-mrpc-tf 1 490.68 492.10 -0.29%
pytorch-examples-wlang-gru 1 342.83 334.96 2.35%
pytorch-examples-wlang-lstm 1 512.55 469.54 9.16% 🔆
torchvision-resnet50_1 1 779.45 760.64 2.47%
cadene-dpn92_1 1 463.44 457.65 1.27%
cadene-resnext101_1 1 364.17 363.68 0.13%
onnx-taau-downsample 1 399.85 401.93 -0.52%
dlrm-criteoterabyte 1 32.40 12.36 162.07% 🔆
dlrm-criteoterabyte_fp16 1 51.79 29.66 74.62% 🔆
agentmodel 1 9,432.27 10,523.13 -10.37% 🔴
unet_fp16 2 56.87 57.23 -0.61%
resnet50v1_fp16 1 939.45 959.87 -2.13%
resnet50v1_int8 1 929.89 942.92 -1.38%
bert_base_cased_fp16 64 1,098.07 1,092.47 0.51%
bert_large_uncased_fp16 32 346.36 345.19 0.34%
bert_large_fp16 1 203.41 203.23 0.08%
distilgpt2_fp16 16 2,093.83 2,096.77 -0.14%
yolov5s 1 568.33 564.74 0.64%
tinyllama 1 18.30 46.00 -60.22% 🔴
vicuna-fastchat 1 44.21 44.04 0.39%
whisper-tiny-encoder 1 417.44 419.55 -0.50%
whisper-tiny-decoder 1 52.38 414.85 -87.37% 🔴
llama2_7b 1 20.34 20.42 -0.40%
qwen1.5-7b 1 12.76 21.75 -41.33% 🔴
phi3-3.8b 1 11.34 26.81 -57.71% 🔴
llama3-8b 1 21.75 21.83 -0.38%
whisper-large-encoder 1 3.05 6.50 -53.07% 🔴
whisper-large-decoder 1 2.61 106.80 -97.55% 🔴
mistral-7b 1 15.73 23.85 -34.05% 🔴
FLUX.1-schnell 1 763.51 763.88 -0.05%

Regressions detected 🔴

@gh-app-migraphx-bot-pr-write

gh-app-migraphx-bot-pr-write Bot commented Jun 18, 2026

Copy link
Copy Markdown
Test Status Result
bert-mrpc-onnx PASSED: MIGraphX meets tolerance
bert-mrpc-tf PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-gru PASSED: MIGraphX meets tolerance
pytorch-examples-wlang-lstm PASSED: MIGraphX meets tolerance
dlrm-criteoterabyte PASSED: MIGraphX meets tolerance
agentmodel PASSED: MIGraphX meets tolerance
unet PASSED: MIGraphX meets tolerance
resnet50v1 PASSED: MIGraphX meets tolerance
bert_base_cased_fp16 PASSED: MIGraphX meets tolerance
bert_large_uncased_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
bert_large PASSED: MIGraphX meets tolerance
yolov5s PASSED: MIGraphX meets tolerance
tinyllama PASSED: MIGraphX meets tolerance
vicuna-fastchat PASSED: MIGraphX meets tolerance
whisper-tiny-encoder PASSED: MIGraphX meets tolerance
whisper-tiny-decoder PASSED: MIGraphX meets tolerance
distilgpt2_fp16 🔴 FAILED: MIGraphX is not within tolerance - check verbose output
llama2_7b PASSED: MIGraphX meets tolerance
qwen1.5-7b PASSED: MIGraphX meets tolerance
phi3-3.8b PASSED: MIGraphX meets tolerance
llama3-8b PASSED: MIGraphX meets tolerance
whisper-large-decoder PASSED: MIGraphX meets tolerance
mistral-7b PASSED: MIGraphX meets tolerance
FLUX.1-schnell PASSED: MIGraphX meets tolerance

@TedThemistokleous
TedThemistokleous marked this pull request as ready for review June 18, 2026 21:01
@TedThemistokleous TedThemistokleous changed the title [AIMIGRAPHX-885 ] Add concat reshape matcher [AIMIGRAPHX-885] Add concat reshape matcher Jun 18, 2026
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4984   +/-   ##
========================================
  Coverage    92.73%   92.74%           
========================================
  Files          592      594    +2     
  Lines        31289    31351   +62     
========================================
+ Hits         29015    29074   +59     
- Misses        2274     2277    +3     
Files with missing lines Coverage Δ
src/simplify_reshapes.cpp 97.99% <100.00%> (+0.02%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TedThemistokleous TedThemistokleous added the high priority A PR with high priority for review and merging. label Jun 22, 2026
@TedThemistokleous TedThemistokleous self-assigned this Jun 23, 2026
Comment thread src/simplify_reshapes.cpp Outdated
Comment thread src/simplify_reshapes.cpp
@causten
causten merged commit fb7f604 into develop Jun 25, 2026
32 of 36 checks passed
@causten
causten deleted the add_concat_reshape_matcher branch June 25, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority A PR with high priority for review and merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants