-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bundle elements performance regression #2396
Merged
Merged
Conversation
This file contains 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
jackkoenig
force-pushed
the
fix-bundle-elements-perf-regression
branch
3 times, most recently
from
February 4, 2022 00:23
878a9ca
to
b642a2f
Compare
Bundle.elements now will only do post-processing if the user is using plugin-generated _elementsImpl. This improves performance for the case where the user does not opt-in to using the plugin to generate _elementsImpl.
jackkoenig
force-pushed
the
fix-bundle-elements-perf-regression
branch
from
February 4, 2022 00:33
b642a2f
to
f8e1454
Compare
chick
approved these changes
Feb 4, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the solution
mergify bot
pushed a commit
that referenced
this pull request
Feb 4, 2022
* Only call _elementsImpl once in Bundle.elements * Distinguish compiler plugin and reflective _elementsImpl Bundle.elements now will only do post-processing if the user is using plugin-generated _elementsImpl. This improves performance for the case where the user does not opt-in to using the plugin to generate _elementsImpl. (cherry picked from commit 5fead89)
mergify bot
added a commit
that referenced
this pull request
Feb 4, 2022
* Only call _elementsImpl once in Bundle.elements * Distinguish compiler plugin and reflective _elementsImpl Bundle.elements now will only do post-processing if the user is using plugin-generated _elementsImpl. This improves performance for the case where the user does not opt-in to using the plugin to generate _elementsImpl. (cherry picked from commit 5fead89) Co-authored-by: Jack Koenig <koenig@sifive.com>
14 tasks
jackkoenig
pushed a commit
that referenced
this pull request
Feb 28, 2023
* Add option to disable random mem/reg init Co-authored-by: Jiuyang Liu <liu@jiuyang.me> * fix for code review. Co-authored-by: SharzyL <me@sharzy.in>
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.
I previously measured that #2306 improved the performance of Chisel3 on a typical large SiFive design by 16%, more careful measurements show that number to actually be 30%.
However, this benefit only comes if the user uses the scalacOption
-P:chiselplugin:genBundleElements
which tells the Chisel compiler plugin to generateBundle.elements
. I then tried this typical large SiFive design without that scalacOption and I found Chisel to run 21% slower. Considering most users will bump to 3.5.1 and won't apply that new scalacOption immediately (if they ever do), this slowdown is unacceptable.This PR changes 2 small things:
-P:chiselplugin:genBundleElements
(although probably a very small amount)._elementsImpl
use the exact old implementation ofBundle.elements
,Bundle.elements
then matches on the output of_elementsImpl
and just returns immediately when its the reflective implementation.This appears to fully mitigate the slowdown.
I tested this on SiFive designs as well as by disabling Bundle.elements generation in the chisel3 tests and running
sbt test
.Contributor Checklist
docs/src
?No release notes necessary because this feature is not yet released.
Type of Improvement
API Impact
No impact
Backend Code Generation Impact
No impact
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
3.4.x
, [small] API extension:3.5.x
, API modification or big change:3.6.0
)?Please Merge
?