-
Notifications
You must be signed in to change notification settings - Fork 766
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
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d04b01a
to
44773dc
Compare
3150a60
to
3a23d2d
Compare
3a23d2d
to
145e81f
Compare
cperkinsintel
approved these changes
Dec 17, 2024
Marking this PR draft to address feedback received offline. |
@cperkinsintel Since your last review I made the following changes:
|
cperkinsintel
approved these changes
Dec 20, 2024
@intel/llvm-gatekeepers the PR is ready to be merged. |
againull
pushed a commit
that referenced
this pull request
Jan 1, 2025
#16289 implemented eviction for persistent cache. This PR extends it to `kernel_compiler` cache as well.
sarnex
pushed a commit
that referenced
this pull request
Jan 6, 2025
Regression after: #16289 fixes #16515 **Problem** The exception is thrown when one process tries to calculate cache size and another process simultaneously inserted/removed any item from the cache. This might cause std::filesystem::recursive_directory iterator to throw std::filesystem_error. **Solution** We catch the exception and just skip over to the next item. This means that while calculating the size of cache we might not consider the size of any item added/removed from cache in the meanwhile. We calculate the cache size only once (for all processes/threads using the same cache) and that too the first-time persistent cache is used by any process. So, this race is rather rare and just ignoring the exception would work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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 thecache_size.txt
file. This file is used to track the size of persistent cache. For backwards compatibility, if SYCL RT does not findcache_size.txt
in the cache root, it will create once. All access tocache_size.txt
are done usingLockCacheItem
, to prevent data races.cache_size.txt
file and if the cache size exceeds the threshold, eviction is triggered.