8000 Add a feature to name cached memoizations and to evict them by name. by zvookin · Pull Request #5510 · halide/Halide · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 20 commits into from
Dec 17, 2020

Conversation

zvookin
Copy link
Member
@zvookin zvookin commented Dec 2, 2020

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 .

@zvookin zvookin requested a review from dsharletg December 2, 2020 07:58
@steven-johnson
Copy link
Contributor
steven-johnson commented Dec 2, 2020

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) {
Copy link
Contributor

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?

@alexreinking alexreinking added this to the v12.0.0 milestone Dec 11, 2020
@steven-johnson
Copy link
Contributor

Not sure how to resolve the merge conflict here.

@steven-johnson
Copy link
Contributor

Looks good, ready to land

@zvookin zvookin merged commit 83b040d into master Dec 17, 2020
@dsharletg dsharletg deleted the memoize_eviction_name branch July 14, 2021 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0