Skip to content

Commit fb27f2c

Browse files
committed
[Review] AMD_COMGR_CACHE_DIR='' means use default directory instead of disable cache
1 parent 0182371 commit fb27f2c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

amd/comgr/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ If an issue arises during cache initialization, the execution will proceed with
121121
the cache turned off.
122122

123123
By default, the cache is turned off, set the environment variable
124-
`AMD_COMGR_CACHE=1` to enable it. This may change in a future release.
124+
`AMD_COMGR_CACHE=1` to enable it.
125125

126126
* `AMD_COMGR_CACHE`: When unset or set to 0, the cache is turned off.
127-
* `AMD_COMGR_CACHE_DIR`: When set to "", the cache is turned off. If assigned a
128-
value, that value is used as the path for cache storage. By default, it is
129-
directed to "$XDG_CACHE_HOME/comgr" (which defaults to
127+
* `AMD_COMGR_CACHE_DIR`: If assigned a non-empty value, that value is used as
128+
the path for cache storage. If the variable is unset or set to an empty string `""`,
129+
it is directed to "$XDG_CACHE_HOME/comgr" (which defaults to
130130
"$USER/.cache/comgr" on Linux, and "%LOCALAPPDATA%\cache\comgr"
131131
on Microsoft Windows).
132132
* `AMD_COMGR_CACHE_POLICY`: If assigned a value, the string is interpreted and

amd/comgr/src/comgr-env.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ StringRef getCacheDirectory() {
8888
if (CacheDisabled)
8989
return "";
9090

91-
static const char *EnvCacheDirectory = std::getenv("AMD_COMGR_CACHE_DIR");
92-
if (EnvCacheDirectory)
91+
StringRef EnvCacheDirectory = std::getenv("AMD_COMGR_CACHE_DIR");
92+
if (!EnvCacheDirectory.empty())
9393
return EnvCacheDirectory;
9494

9595
// mark Result as static to keep it cached across calls

0 commit comments

Comments
 (0)