Skip to content
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

[SYCL] Implement eviction in persistent cache #16289

Open
wants to merge 8 commits into
base: sycl
Choose a base branch
from

Conversation

uditagarwal97
Copy link
Contributor

@uditagarwal97 uditagarwal97 commented Dec 5, 2024

This PR implements eviction for persistent cache.
Eviction is disabled by default and can be controlled by the user via SYCL_CACHE_MAX_SIZE variable.

Here's how eviction works:

  1. File size: A file called, cache_size.txt, is stored at the root of persistent cache. Every time a process adds a new entry to cache, it will also update the cache_size.txt file. This file is used to track the size of persistent cache. For backwards compatibility, if SYCL RT does not find cache_size.txt in the cache root, it will create once. All access to cache_size.txt are done using LockCacheItem, to prevent data races.
  2. When adding a new entry to cache, SYCL RT will check the cache_size.txt file and if the cache size exceeds the threshold, eviction is triggered.
  3. During eviction, SYCL RT will determine the last access time of each cache entry (using POSIX's stat or Window's GetFileAttribute). Items are evicted based on the LRU policy.

@uditagarwal97 uditagarwal97 marked this pull request as ready for review December 10, 2024 15:31
@uditagarwal97 uditagarwal97 requested a review from a team as a code owner December 10, 2024 15:31
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.

1 participant