Skip to content

Commit d7dccc2

Browse files
authored
[Comgr][Cache] Enable the cache by default (llvm#1084)
2 parents c2248d9 + b7ce0eb commit d7dccc2

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
@@ -120,10 +120,10 @@ and eviction policy can be manipulated through specific environment variables.
120120
If an issue arises during cache initialization, the execution will proceed with
121121
the cache turned off.
122122

123-
By default, the cache is turned off, set the environment variable
124-
`AMD_COMGR_CACHE=1` to enable it.
123+
By default, the cache is enabled.
125124

126-
* `AMD_COMGR_CACHE`: When unset or set to 0, the cache is turned off.
125+
* `AMD_COMGR_CACHE`: When unset or set to a value different than "0", the cache is enabled.
126+
Disabled when set to "0".
127127
* `AMD_COMGR_CACHE_DIR`: If assigned a non-empty value, that value is used as
128128
the path for cache storage. If the variable is unset or set to an empty string `""`,
129129
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
@@ -81,10 +81,9 @@ StringRef getCachePolicy() {
8181
}
8282

8383
StringRef getCacheDirectory() {
84-
// By default the cache is deactivated. We hope to remove this variable in the
85-
// future.
84+
// By default the cache is enabled
8685
static const char *Enable = std::getenv("AMD_COMGR_CACHE");
87-
bool CacheDisabled = !Enable || StringRef(Enable) == "0";
86+
bool CacheDisabled = StringRef(Enable) == "0";
8887
if (CacheDisabled)
8988
return "";
9089

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)