Repository navigation
perf(cuda): reuse file mappings - #10717
Conversation
Merging this PR will degrade performance by 18.95%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
8ed5762 to
18c5897
Compare
d006295 to
715005f
Compare
cbbedfc to
5d8b5f3
Compare
18c5897 to
a149621
Compare
Cache mappings by file identity and version so repeated scans reuse filled page tables. Add Rust and C APIs to release cached mappings before cold-cache eviction while active readers retain their mappings. Include reuse, versioning, release, and concurrent-read coverage. Original-commit: a31e77427e Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
a149621 to
34a45d9
Compare
## Problem Closing a mapped reader can stall decoding while waiting for GPU copies and releasing page tables. ## Solution Move synchronization and mapping release to a background worker; drain queued releases before explicit cache eviction. ## Assessment Falls back to synchronous release if queuing fails and retains mappings if completion is unknown. Depends on #10717. Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Since #10717, the mapping cache keeps up to 64 recently opened files mapped after their readers close, so later scans reuse the filled page tables. A mapping keeps its file's inode, and with it the file's disk space, allocated even after the file is deleted, and a deleted file's cache entry can never be reused. An application that scans temporary files through CUDA and deletes them kept the space of the last 64, whatever their size, until they were evicted or the mappings released. Keep the mapped file open to check whether it was deleted, and drop the cached mappings of deleted files whenever a file is mapped and whenever a reader closes. A file deleted while idle in the cache keeps its space until the next CUDA file open or `release_file_mappings`. Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Since #10717, the mapping cache keeps up to 64 recently opened files mapped after their readers close, so later scans reuse the filled page tables. A mapping keeps its file's inode, and with it the file's disk space, allocated even after the file is deleted, and a deleted file's cache entry can never be reused. An application that scans temporary files through CUDA and deletes them kept the space of the last 64, whatever their size, until they were evicted or the mappings released. Keep the mapped file open to check whether it was deleted, and drop the cached mappings of deleted files whenever a file is mapped and whenever a reader closes. A file deleted while idle in the cache keeps its space until the next CUDA file open or `release_file_mappings`. Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Since #10717, the mapping cache keeps up to 64 recently opened files mapped after their readers close, so later scans reuse the filled page tables. A mapping keeps its file's inode, and with it the file's disk space, allocated even after the file is deleted, and a deleted file's cache entry can never be reused. An application that scans temporary files through CUDA and deletes them kept the space of the last 64, whatever their size, until they were evicted or the mappings released. Keep the mapped file open to check whether it was deleted, and drop the cached mappings of deleted files whenever a file is mapped and whenever a reader closes. A file deleted while idle in the cache keeps its space until the next CUDA file open or `release_file_mappings`. Signed-off-by: Alexander Droste <alexander.droste@protonmail.com>
Problem
Repeated scans rebuild file mappings and page tables; caching them also needs explicit support for cold-cache eviction.
Solution
Cache mappings by file identity/version and add
release_file_mappings()andvx_cuda_release_file_mappings().Assessment
Callers can release cached mappings before eviction while active readers retain ownership. Depends on #10716.