Skip to content

Comments

Prevent cache base64 dir names from starting with a hyphen#5088

Merged
peterbell10 merged 7 commits intotriton-lang:mainfrom
fulvius31:base64_cache_dir_unix
Nov 11, 2024
Merged

Prevent cache base64 dir names from starting with a hyphen#5088
peterbell10 merged 7 commits intotriton-lang:mainfrom
fulvius31:base64_cache_dir_unix

Conversation

@fulvius31
Copy link
Contributor

Modify the _base64 function used for filename generation to ensure filenames do not start with a hyphen (-).

Added _ensure_safe_filename function (called from the function created in #4553) in order to prepend an underscore (_) if the filename starts with a hyphen.

This change prevents issues on Unix-like systems where filenames beginning with a hyphen can be misinterpreted as command-line options.

in this way we adhere to to the The Linux Information Project's File Naming Conventions:

"File names should never begin with a hyphen"

A comparison:

> % ls ~/.triton/cache | grep Je
-Je_Q76rOEnQX9OiOEGIGqVntN-TID5IpPmsSKEyogo  _-Je_Q76rOEnQX9OiOEGIGqVntN-TID5IpPmsSKEyogo

The test_core.py runs without errors.

The core Triton is a small number of people, and we receive many PRs (thank
you!). To help us review your code more quickly, if you are a new
contributor (less than 3 PRs merged) we ask that you complete the following
tasks and include the filled-out checklist in your PR description.

Complete the following tasks before sending your PR, and replace [ ] with
[x] to indicate you have done them.

  • I am not making a trivial change, such as fixing a typo in a comment.

  • I have written a PR description following these
    rules.

  • I have run pre-commit run --from-ref origin/main --to-ref HEAD.

  • Select one of the following.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a test because FILL THIS IN.
  • Select one of the following.

    • I have not added any lit tests.
    • The lit tests I have added follow these best practices,
      including the "tests should be minimal" section. (Usually running Python code
      and using the instructions it generates is not minimal.)

to prevent issues with command-line operations on Unix-like systems.
@fulvius31 fulvius31 requested a review from ptillet as a code owner November 6, 2024 22:21
Copy link
Contributor

@minjang minjang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing this issue! LGTM. Let an OpenAI folk merge this PR.

@peterbell10 peterbell10 merged commit a69ebfa into triton-lang:main Nov 11, 2024
@fulvius31 fulvius31 deleted the base64_cache_dir_unix branch November 11, 2024 18:23
fulvius31 added a commit to fulvius31/pytorch that referenced this pull request Nov 11, 2024
In pytorch#140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Nov 12, 2024
In #140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32

Pull Request resolved: #140297
Approved by: https://github.com/davidberard98
zhangxiaoli73 pushed a commit to zhangxiaoli73/pytorch that referenced this pull request Nov 13, 2024
In pytorch#140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32

Pull Request resolved: pytorch#140297
Approved by: https://github.com/davidberard98
Luosuu pushed a commit to Luosuu/triton that referenced this pull request Nov 13, 2024
…riton-lang#5088)

Modify the _base64 function used for filename generation to ensure
filenames do not start with a hyphen (`-`).

This change prevents issues on Unix-like systems where filenames
beginning with a hyphen can be misinterpreted as command-line options.

in this way we adhere to to the [The Linux Information Project's File
Naming Conventions](https://www.linfo.org/file_name.html):
> "File names should never begin with a hyphen"
Ryo-not-rio pushed a commit to Ryo-not-rio/pytorch that referenced this pull request Dec 2, 2024
In pytorch#140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32

Pull Request resolved: pytorch#140297
Approved by: https://github.com/davidberard98
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
In pytorch#140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32

Pull Request resolved: pytorch#140297
Approved by: https://github.com/davidberard98
fmo-mt pushed a commit to fmo-mt/pytorch that referenced this pull request Dec 11, 2024
In pytorch#140190 the base64 function is imported from triton

But, since triton-lang/triton#5088 ,
the base64 function was replaced to base32

Pull Request resolved: pytorch#140297
Approved by: https://github.com/davidberard98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants