Skip to content

Commit 4c66d60

Browse files
committed
[Comgr][Cache] Enably the cache by default
1 parent 74d62d7 commit 4c66d60

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

amd/comgr/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ and eviction policy can be manipulated through specific environment variables.
131131
If an issue arises during cache initialization, the execution will proceed with
132132
the cache turned off.
133133

134-
By default, the cache is turned off, set the environment variable
135-
`AMD_COMGR_CACHE=1` to enable it.
134+
By default, the cache is enabled.
136135

137-
* `AMD_COMGR_CACHE`: When unset or set to 0, the cache is turned off.
136+
* `AMD_COMGR_CACHE`: When unset or set to a value different than "0", the cache is enabled.
137+
Disabled when set to "0".
138138
* `AMD_COMGR_CACHE_DIR`: If assigned a non-empty value, that value is used as
139139
the path for cache storage. If the variable is unset or set to an empty string `""`,
140140
it is directed to "$XDG_CACHE_HOME/comgr" (which defaults to

amd/comgr/src/comgr-env.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,9 @@ StringRef getCachePolicy() {
280280
}
281281

282282
StringRef getCacheDirectory() {
283-
// By default the cache is deactivated. We hope to remove this variable in the
284-
// future.
283+
// By default the cache is enabled
285284
static const char *Enable = std::getenv("AMD_COMGR_CACHE");
286-
bool CacheDisabled = !Enable || StringRef(Enable) == "0";
285+
bool CacheDisabled = StringRef(Enable) == "0";
287286
if (CacheDisabled)
288287
return "";
289288

amd/comgr/test-lit/compile-minimal-test-cached.cl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// RUN: unset AMD_COMGR_CACHE
44
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test %S/compile-minimal-test.cl %t.bin
55
// RUN: llvm-objdump -d %t.bin | FileCheck %S/compile-minimal-test.cl
6-
// RUN: [ ! -d %t.cache ]
6+
// RUN: [ -d %t.cache ]
7+
//
8+
// RUN: rm -fr %t.cache
79
//
810
// RUN: export AMD_COMGR_CACHE=0
911
// RUN: AMD_COMGR_CACHE_DIR=%t.cache compile-minimal-test %S/compile-minimal-test.cl %t.bin

0 commit comments

Comments
 (0)