-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
PseudoLRU non-power-of-2 #2493
PseudoLRU non-power-of-2 #2493
Conversation
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 think if you actually want them to run on every PR CI you have to add them to UnittestSuite
list in regression/Makefile
PLRU. get_next_state
made my eyes cross so i applaud you for adding a unit test
regression/Makefile
Outdated
@@ -61,7 +61,7 @@ endif | |||
|
|||
ifeq ($(SUITE),UnittestSuite) | |||
PROJECT=freechips.rocketchip.unittest | |||
CONFIGS=$(PROJECT).AMBAUnitTestConfig $(PROJECT).TLSimpleUnitTestConfig $(PROJECT).TLWidthUnitTestConfig | |||
CONFIGS=$(PROJECT).AMBAUnitTestConfig $(PROJECT).TLSimpleUnitTestConfig $(PROJECT).TLWidthUnitTestConfig $(PROJECT).ScatterGatherTestConfig $(PROJECT).PLRUUnitTestConfig $(PROJECT).PowerQueueTestConfig |
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.
This is probably too long of a line for lint et al, right?
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.
not sure about lint in makefiles, but the line keeps getting shorter as I remove tests that I tried to add but fail in CI regressions! 🙃
state(this_ways-3,half_ways-1)), | ||
Mux(way(log2Ceil(this_ways)-1), | ||
state(half_ways-2,0), | ||
get_next_state(state(half_ways-2,0), way(log2Ceil(half_ways)-1,0), half_ways))) |
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.
@johningalls-sifive can you add some comments here or in another file that explains in detail what is going on? The software-engineer in me sees all these magic -3, -2, -1 values, and the lack of comments, and although I trust you that it does the right thing, I don't know if anyone besides you can maintain this function as it currently is! :)
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 agree completely and went through the PseudoLRU code again. Let me know if it's improved now!
} | ||
} | ||
|
||
def get_next_state(state: UInt, way: UInt, this_ways: Int): UInt = { |
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'm a fan of descriptive parameter and variable names. Would either n_ways or this_nways be better than just "this_ways", which (to me at least) does not clearly convey that it is the total number of ways?
Similarly, I'd change "way" to "touched_way", and if typing that is too annoying, say val w = touched_way, and use w in the code below for conciseness. That way, people fully understand the parameters to get_next_state() even without any comments.
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 changed it to tree_nways
and touch_way
this (and other) unit test that I tried to add to the PR CI regression Makefile fails with
|
the PLRU unit test is passing running this command locally:
|
* PLRUTest passing 2,4 ways * PLRUTest passing 3 ways * PLRUTest unexpected discrepancies with 6 ways: never replaces way 5 * PLRUTest failing 6 ways: never replaces way 5 * PLRU for non-power-of-two entries * TrueLRU * expose some class ReplacementPolicy public def * PLRU gracefully handle 1 way * add all remaining UnitTestConfig to regression * TLXbarUnitTest fails to elaborate * ECCUnitTest passes locally but fails in CI * ScatterGatherTest passes locally but fails in CI * PLRUUnitTest passes locally but fails in CI * PowerQueueTestConfig passes locally but fails in CI * more explanation in variable names and comments * PseudoLRU get_next_state touch_way_sized padTo/extract * deprecate old methods
Related issue:
Type of change: performance enhancement
Impact: API addition (no impact on existing code)
Development Phase: implementation
Release Notes