-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add a feature to name cached memoizations and to evict them by name. #5510
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
Conversation
Add test case with a called extern to set the eviction key.
The build failures should go away if you sync to master. EDIT: took the liberty of doing so myself after the builtbots restarted. |
CacheEntry **prev = &cache_entries[i]; | ||
while (entry != nullptr) { | ||
CacheEntry *next = entry->next; | ||
if (entry->has_eviction_key && entry->eviction_key == eviction_key) { |
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 this list removal be in a helper function? It looks like all the other potential uses are removing from the end and so are a bit simpler, but I think maybe it would be better if they all used a more general list removal helper anyways?
…re calling convention evolution.
Not sure how to resolve the merge conflict here. |
Looks good, ready to land |
Per discussion with @dsharletg, this allows "naming" memoizations with 64-bits and then evicting entries by using that name. The name is not part of the cache key and is user chosen. A pointer value, a hash of image data, or a monotonic counter are all possibilities for cache eviction names.
I have a small design doc in progress that I will share shortly. It covers the possibility of using multiple typed names of this sort to allow caching CPU allocations as well. (The runtime automatically adds the GPU context as an eviction name and whenever a GPU context is freed, its bit value is used to evict all allocations on that context from the memoization cache.)
Wanted to get the review/buildbot process started here.
Addresses the second item in issue #5465 .