triton-lang / triton

Development repository for the Triton language and compiler

Home Page:https://triton-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Follow the XDG Base Directory Specification

RuRo opened this issue · comments

commented

Currently, triton uses ~/.triton as a temporary directory for cache files by default. Putting stuff directly in the user's home directory is considered bad practice and is not compliant with the XDG Base Directory Specification. It's possible to change this location by setting the TRITON_CACHE_DIR environment variable, however

  1. it appears that TRITON_CACHE_DIR only affects the location of ~/.triton/cache, not ~/.triton/dump and ~/.triton/override and there is no way to configure the other two locations

  2. expecting the user to manually configure each program/library to use the correct locations for config/data/cache/runtime directories isn't very nice

Ideally, triton should support the XDG Base Directory Specification. In practice, this means doing something like

def default_cache_dir():
    default_xdg_cache = os.path.join(Path.home(), ".cache")
    xdg_cache = os.getenv("XDG_CACHE_HOME", default_xdg_cache)
    return os.path.join(xdg_cache, "triton")

I got bit by this when building triton in a virtual environment, which kept failing with out of disk space errors in ~/.triton.

I found TRITON_HOME in the source code for get_home_dir() which I used to work around this. I don't believe this is documented.

I would second the use of XDG_CACHE_HOME.

Can supply patches + doc fixes if that's the way to go.

I added the TRITON_HOME variable a few weeks ago.

Feel free to add it to the Tips for building section in README