Skip to content

Commit f7228a4

Browse files
committed
refactor(core.utils): raw-binary filestream cache, drop SQLite + pickle
* Delete SQLiteProgramCache entirely; FileStreamProgramCache is the only backend. Drops the sqlite3 import and ~500 lines of WAL/VACUUM/eviction plumbing. * Cache stores raw binary verbatim (no pickle, no JSON, no record header) so entry files are directly consumable by external NVIDIA tools (cuobjdump, nvdisasm, cuda-gdb, ...). * API is bytes-in / bytes-out: cache[key] = value accepts bytes-like or ObjectCode (path-backed too -- the file is read at write time so the cache always holds the binary content, not a path); cache[key] returns bytes. Callers reconstruct ObjectCode themselves with the code_type they already know. symbol_mapping is intentionally not preserved. * Eviction is now true LRU by st_atime: every successful read calls os.utime(path, ns=(now, mtime_ns)) to bump atime regardless of mount options or NTFS LastAccess defaults. Replaces the previous st_mtime sort (effectively FIFO). * Default cache directory follows OS conventions when path is omitted: $XDG_CACHE_HOME/cuda-python/program-cache (Linux), ~/Library/Caches/cuda-python/program-cache (macOS), or %LOCALAPPDATA%\cuda-python\program-cache (Windows). * Bump _FILESTREAM_BACKEND_SCHEMA 2 -> 3 so existing pickle-format caches are wiped on first open. * Tests rewritten: drop SQLite suite, drop pickle/corruption tests, add atime-LRU regression, add path-backed-accept regression, add raw-binary on-disk regression, add multiprocess eviction-race test (rewriter vs. churner) for the stat-guarded eviction path.
1 parent 61469c1 commit f7228a4

5 files changed

Lines changed: 431 additions & 1194 deletions

File tree

cuda_core/cuda/core/utils/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@
1010
__all__ = [
1111
"FileStreamProgramCache",
1212
"ProgramCacheResource",
13-
"SQLiteProgramCache",
1413
"StridedMemoryView",
1514
"args_viewable_as_strided_memory",
1615
"make_program_cache_key",
1716
]
1817

1918
# Lazily expose the program-cache APIs so ``from cuda.core.utils import
20-
# StridedMemoryView`` stays lightweight -- the cache backends pull in driver,
19+
# StridedMemoryView`` stays lightweight -- the cache backend pulls in driver,
2120
# NVRTC, and module-load machinery that memoryview-only consumers do not need.
2221
_LAZY_CACHE_ATTRS = frozenset(
2322
{
2423
"FileStreamProgramCache",
2524
"ProgramCacheResource",
26-
"SQLiteProgramCache",
2725
"make_program_cache_key",
2826
}
2927
)

0 commit comments

Comments
 (0)