find_nop_reshapes: Remove extra assignments/inserts#4696
Open
TedThemistokleous wants to merge 5 commits intodevelopfrom
Open
find_nop_reshapes: Remove extra assignments/inserts#4696TedThemistokleous wants to merge 5 commits intodevelopfrom
TedThemistokleous wants to merge 5 commits intodevelopfrom
Conversation
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 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
🚀 New features to boost your workflow:
|
pfultz2
requested changes
Mar 23, 2026
anisha-amd
reviewed
Mar 23, 2026
anisha-amd
approved these changes
Mar 23, 2026
kahmed10
approved these changes
Mar 23, 2026
Co-authored-by: anisha-amd <anisha.sankar@amd.com>
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.
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.mdentry for any option other thanNot Applicable