Skip to content

Commit 74d62d7

Browse files
committed
[Review] AMD_COMGR_CACHE_DIR='' means use default directory instead of disable cache
1 parent 29e5be8 commit 74d62d7

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
@@ -132,12 +132,12 @@ If an issue arises during cache initialization, the execution will proceed with
132132
the cache turned off.
133133

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

137137
* `AMD_COMGR_CACHE`: When unset or set to 0, the cache is turned off.
138-
* `AMD_COMGR_CACHE_DIR`: When set to "", the cache is turned off. If assigned a
139-
value, that value is used as the path for cache storage. By default, it is
140-
directed to "$XDG_CACHE_HOME/comgr" (which defaults to
138+
* `AMD_COMGR_CACHE_DIR`: If assigned a non-empty value, that value is used as
139+
the path for cache storage. If the variable is unset or set to an empty string `""`,
140+
it is directed to "$XDG_CACHE_HOME/comgr" (which defaults to
141141
"$USER/.cache/comgr" on Linux, and "%LOCALAPPDATA%\cache\comgr"
142142
on Microsoft Windows).
143143
* `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
@@ -287,8 +287,8 @@ StringRef getCacheDirectory() {
287287
if (CacheDisabled)
288288
return "";
289289

290-
static const char *EnvCacheDirectory = std::getenv("AMD_COMGR_CACHE_DIR");
291-
if (EnvCacheDirectory)
290+
StringRef EnvCacheDirectory = std::getenv("AMD_COMGR_CACHE_DIR");
291+
if (!EnvCacheDirectory.empty())
292292
return EnvCacheDirectory;
293293

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

0 commit comments

Comments
 (0)