-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Use base64 for shorter cache directories #4553
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
Merged
Merged
Conversation
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
ThomasRaoux
approved these changes
Aug 22, 2024
Collaborator
ThomasRaoux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice
Jokeren
pushed a commit
that referenced
this pull request
Aug 24, 2024
Not sure this is worthy to make it? I was annoyed by long sha256-based cache directory names, mostly 64 chars. So I quickly added base64-based shorter cache directory names. Instead of fixing a dozen places that use `hashlib.sha256`, I patched the cache manager. 64-char names are mostly reduced to 43-44 chars. A comparison: ``` > % ls -l $TRITON_CACHE_DIR total 0 drwxr-xr-x 1 minjang users 40 Aug 21 19:02 44ae4aee7ef0ee0dd54e860cf44627e3b6cedabe87a228ac75988301b8a6bf60 drwxr-xr-x 1 minjang users 26 Aug 21 19:02 82dc2c9a5508bf07c72e02353c1e751dc54aae85666f139b2867b0a1e95e0e7b drwxr-xr-x 1 minjang users 226 Aug 21 19:02 b8e240968a85711ba57b17bf8450f1ffbc85a8de8cd1f47aa87b241b53f9bf60 drwxr-xr-x 1 minjang users 26 Aug 21 19:03 gtwsmlUIvwfHLgI1PB51HcVKroVmbxObKGewoeleDns drwxr-xr-x 1 minjang users 40 Aug 21 19:03 RK5K7n7w7g3VToYM9EYn47bO2r6HoiisdZiDAbimv2A drwxr-xr-x 1 minjang users 226 Aug 21 19:03 uOJAloqFcRulexe_hFDx_7yFqN6M0fR6qHskG1P5v2A ``` `test_core.py` runs without any errors, and the cache directory has all base64-based shorter names.
7 tasks
davidberard98
added a commit
to pytorch/pytorch
that referenced
this pull request
Nov 8, 2024
In old triton versions, you take the hash of the triton kernel and use it in the filepath for the cached kernel. In Triton 3.2 (after triton-lang/triton#4553), the filepath will use the base-64-encoded representation of the hash in the path. This PR checks whether the `_base64` function exists in triton, and if so, uses the base-64-encoded represenatation in the path. [ghstack-poisoned]
davidberard98
added a commit
to pytorch/pytorch
that referenced
this pull request
Nov 8, 2024
In old triton versions, you take the hash of the triton kernel and use it in the filepath for the cached kernel. In Triton 3.2 (after triton-lang/triton#4553), the filepath will use the base-64-encoded representation of the hash in the path. This PR checks whether the `_base64` function exists in triton, and if so, uses the base-64-encoded represenatation in the path. ghstack-source-id: f0e880d Pull Request resolved: #140190
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Nov 11, 2024
In old triton versions, you take the hash of the triton kernel and use it in the filepath for the cached kernel. In Triton 3.2 (after triton-lang/triton#4553), the filepath will use the base-64-encoded representation of the hash in the path. This PR checks whether the `_base64` function exists in triton, and if so, uses the base-64-encoded represenatation in the path. ghstack-source-id: 92c2018 Pull Request resolved: #140190
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Nov 11, 2024
…0190) In old triton versions, you take the hash of the triton kernel and use it in the filepath for the cached kernel. In Triton 3.2 (after triton-lang/triton#4553), the filepath will use the base-64-encoded representation of the hash in the path. This PR checks whether the `_base64` function exists in triton, and if so, uses the base-64-encoded represenatation in the path. Pull Request resolved: #140190 Approved by: https://github.com/ezyang
pobin6
pushed a commit
to pobin6/pytorch
that referenced
this pull request
Dec 5, 2024
…orch#140190) In old triton versions, you take the hash of the triton kernel and use it in the filepath for the cached kernel. In Triton 3.2 (after triton-lang/triton#4553), the filepath will use the base-64-encoded representation of the hash in the path. This PR checks whether the `_base64` function exists in triton, and if so, uses the base-64-encoded represenatation in the path. Pull Request resolved: pytorch#140190 Approved by: https://github.com/ezyang
bertmaher
pushed a commit
to bertmaher/triton
that referenced
this pull request
Dec 10, 2024
Not sure this is worthy to make it? I was annoyed by long sha256-based cache directory names, mostly 64 chars. So I quickly added base64-based shorter cache directory names. Instead of fixing a dozen places that use `hashlib.sha256`, I patched the cache manager. 64-char names are mostly reduced to 43-44 chars. A comparison: ``` > % ls -l $TRITON_CACHE_DIR total 0 drwxr-xr-x 1 minjang users 40 Aug 21 19:02 44ae4aee7ef0ee0dd54e860cf44627e3b6cedabe87a228ac75988301b8a6bf60 drwxr-xr-x 1 minjang users 26 Aug 21 19:02 82dc2c9a5508bf07c72e02353c1e751dc54aae85666f139b2867b0a1e95e0e7b drwxr-xr-x 1 minjang users 226 Aug 21 19:02 b8e240968a85711ba57b17bf8450f1ffbc85a8de8cd1f47aa87b241b53f9bf60 drwxr-xr-x 1 minjang users 26 Aug 21 19:03 gtwsmlUIvwfHLgI1PB51HcVKroVmbxObKGewoeleDns drwxr-xr-x 1 minjang users 40 Aug 21 19:03 RK5K7n7w7g3VToYM9EYn47bO2r6HoiisdZiDAbimv2A drwxr-xr-x 1 minjang users 226 Aug 21 19:03 uOJAloqFcRulexe_hFDx_7yFqN6M0fR6qHskG1P5v2A ``` `test_core.py` runs without any errors, and the cache directory has all base64-based shorter names.
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.
Not sure this is worthy to make it? I was annoyed by long sha256-based cache directory names, mostly 64 chars. So I quickly added base64-based shorter cache directory names.
Instead of fixing a dozen places that use
hashlib.sha256, I patched the cache manager. 64-char names are mostly reduced to 43-44 chars.A comparison:
test_core.pyruns without any errors, and the cache directory has all base64-based shorter names.