Repository navigation
tilecpp: create the cubin cache directory on first compile, not at import - #226
Merged
Merged
Conversation
…port _cuda_utils resolves CACHE_DIR at module import and immediately ran mkdir on it. tilegym imports this module while probing the tilecpp backend, so an unwritable or unusable cache location (read-only home, HOME pointing at a file, TILECPP_CACHE_DIR under a regular file) made `import tilegym` fail with PermissionError / NotADirectoryError even for users who never touch the tilecpp backend. Keep resolving the path at import, but create the directory right before the compiler writes the wrapper source and cubin. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: 0z5a <dezhen.lu@student.uni-tuebingen.de>
2 of 3 tasks
Collaborator
|
/ok to test 618a3fa |
This file contains hidden or 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
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.
Description
tilegym/ops/tilecpp/utils/_cuda_utils.pyrunsmkdiron the cubin cache directory (TILECPP_CACHE_DIR,$XDG_CACHE_HOME/tilecppor~/.cache/tilecpp) when the module is imported. tilegym imports this module while it probes the tilecpp backend, so an unusable cache location breaksimport tilegymitself, including for users who never touch the tilecpp backend:PermissionErrorTILECPP_CACHE_DIRorHOMEpointing below a regular file:NotADirectoryError/FileExistsErrorThis change keeps resolving the path at import time but creates the directory only right before the compiler writes the wrapper
.cuand the cubin.Tests (
tests/test_tilecpp_compiler.py):test_cache_dir_lookup_does_not_create_it: resolving a cache path under a regular file no longer raises and creates nothing. Fails on main withNotADirectoryError.test_compile_creates_missing_output_dir: the first compile creates the missing output directory. Fails on main withFileNotFoundError.On main: 2 failed. With this change: 7 passed. The 7 Linux-only
/proctests in this file were skipped in my run.I emailed my signed CLA (individual) to TileGym@nvidia.com on 2026-11-03.
CI Configuration
Checklist
./format.sh)