Skip to content

find_nop_reshapes: Remove extra assignments/inserts#4696

Open
TedThemistokleous wants to merge 5 commits intodevelopfrom
fix_find_nop_reshapes
Open

find_nop_reshapes: Remove extra assignments/inserts#4696
TedThemistokleous wants to merge 5 commits intodevelopfrom
fix_find_nop_reshapes

Conversation

@TedThemistokleous
Copy link
Collaborator

Make the list a static const auto and remove the inserts that always happen during the matcher after copying the const to a local matcher and then performing the match on find_nop_reshapes()

Cleaning this up should stop the overhead of added copy, inserts and destroying of local variables.

Motivation

Bug hunting for another issue and after performing an analysis on simplify_reshapes() found that this was doing a bunch of create/destroy. Seems like this is worth a simple cleanup and avoids a bunch of copies, allocations and create/destroy.

Technical Details

Since reshape_names() is used once in simplfy_reshapes.cpp, just make it a static const and remove the extra insert assignments that happen on every matcher before we even perform a match. Instead simplify the list so its a simple const lookup from the unordered set and remove the extra inserts/copy.

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.

Make the list a static const auto and  remove the inserts that always happen during the matcher after copying the const to a local matcher and then performing the match on find_nop_reshapes()

Cleaning this up should stop the overhead of added copy, inserts and destroying of local variables.
@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4696      +/-   ##
===========================================
- Coverage    92.27%   92.27%   -0.00%     
===========================================
  Files          578      578              
  Lines        28541    28524      -17     
===========================================
- Hits         26335    26318      -17     
  Misses        2206     2206              
Files with missing lines Coverage Δ
src/simplify_reshapes.cpp 97.95% <100.00%> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TedThemistokleous TedThemistokleous requested a review from a team as a code owner March 23, 2026 16:40
Co-authored-by: anisha-amd <anisha.sankar@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Perf Improve simple small or simple changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants