-
Notifications
You must be signed in to change notification settings - Fork 58
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
Prefetcher API #180
Prefetcher API #180
Conversation
This API proposes to seperate the prefetcher interface (defined in PrefetcherIF.hpp) with actual implementation of prefetch engine (defined in PrefetchEngineIF.hpp). This approach allows the model to rapidly customize the prefetchers with multiple prefetch policies e.g. We can create stride prefetch engine and use the same engine in L2 Prefetcher as well as L3 prefetcher. Prefetchers that depend on external (to prefetcher) state can optionally create an Update Object deriving it from PrefetcherStateUpdateType and pass the updates to the prefetcher. NextLinePrefetchEngine is an example implementation of PrefetchEngineIF DataPrefetcher is an example implementation of a simple prefetcher utilizing the above engine The files have been compile tested. Unit testing, LSU integraion is TBD and will be done after review and possible changes.
|
||
DataPrefetcher::DataPrefetcher(sparta::TreeNode* node, const DataPrefetcherParameterSet* p) : | ||
sparta::Unit(node), | ||
PrefetcherIF<PrefetchEngineIF<>>(dynamic_cast<sparta::Unit*>(this)), |
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.
Is there a way to avoid the dynamic cast? I think you can use the getResourceAs
Sparta method like this:
node->getResourceAs<sparta::Unit*>
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.
Actually, I don't understand the need for the d_c here...
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 will remove the dynamic cast
|
||
//! Process the incoming memory access and send to the engine | ||
void | ||
DataPrefetcher::processIncomingReq(const olympia::MemoryAccessInfoPtr & mem_access_info_ptr) |
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.
Remove new line
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.
sure
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 code looks fine to me.
I've have a question on the API larger intent/future plans. I (will) put this in the originating issue #142
Never mind I found what I was going to ask about in MemoryAccessInfo.
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.
Can you make a diagram on how these classes interrelate? Give this tool a try: http://mermaid.js.org/
|
||
DataPrefetcher::DataPrefetcher(sparta::TreeNode* node, const DataPrefetcherParameterSet* p) : | ||
sparta::Unit(node), | ||
PrefetcherIF<PrefetchEngineIF<>>(dynamic_cast<sparta::Unit*>(this)), |
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.
Actually, I don't understand the need for the d_c here...
} | ||
|
||
//! \brief Flush handler | ||
void DataPrefetcher::handleFlush(const olympia::FlushManager::FlushingCriteria & criteria) |
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.
Curious, does a prefetcher really care about flushes?
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.
It is a placeholder. I can imagine prefetchers making prefetch decisions based on a state change outside and may want to cancel them for performance reasons.
{ | ||
ev_gen_prefetch_.schedule(sparta::Clock::Cycle(1)); | ||
} | ||
} |
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.
else { ?? }
If the prefetch engine is not ready, then 1) why is this function called and 2) should you reschedule for the future in case it will be?
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.
Actually, I just realize that I already checked for isPrefetchReady(), will remove this part of conditional.
Here I am scheduling the next prefetch in queue (if I have credits)
Hey @rajatbhatia1 where are you on this work? |
I'm going to close this PR for now until @rajatbhatia1 has more updates for us to look at. |
Initial version of prefetcher API