feature: enable cl_cache by default on Windows

Related-To: NEO-8092
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski 2023-09-25 12:27:58 +00:00 committed by Compute-Runtime-Automation
parent 9a64179b65
commit e16220dc9f
4 changed files with 25 additions and 2 deletions

View File

@ -119,7 +119,7 @@ reuse previously cached kernel binaries instead of compiling kernels from source
##### Environment flags
NEO_CACHE_PERSISTENT - integer value to enable (1)/disable (0) on-disk binary cache. When enabled
Neo will try to cache and reuse compiled binaries. Default is off.
Neo will try to cache and reuse compiled binaries. Default is on.
NEO_CACHE_DIR - path to persistent cache directory. Default values are %LocalAppData%\NEO\neo_compiler_cache
if %LocalAppData% is found. If none of environment

View File

@ -267,4 +267,23 @@ TEST_F(CompilerCacheTest, GivenCacheMaxSizeSetTo0WhenGetDefaultConfigThenCacheSi
EXPECT_EQ(cacheConfig.cacheDir, "ult\\directory\\");
}
TEST_F(CompilerCacheTest, GivenCachePathExistsAndNoEnvVarsSetWhenGetDefaultCompilerCacheConfigThenCacheIsEnabled) {
bool pathExistsMock = true;
VariableBackup<bool> pathExistsMockBackup(&NEO::SysCalls::pathExistsMock, pathExistsMock);
SysCalls::shGetKnownFolderPathResult = S_OK;
const wchar_t *localAppDataPath = L"C:\\Users\\user1\\AppData\\Local";
wcscpy(SysCalls::shGetKnownFolderSetPath, localAppDataPath);
auto cacheConfig = NEO::getDefaultCompilerCacheConfig();
const std::string expectedCacheDirPath = "C:\\Users\\user1\\AppData\\Local\\NEO\\neo_compiler_cache";
EXPECT_TRUE(cacheConfig.enabled);
EXPECT_EQ(cacheConfig.cacheFileExtension, ".cl_cache");
EXPECT_EQ(cacheConfig.cacheSize, static_cast<size_t>(MemoryConstants::gigaByte));
EXPECT_EQ(cacheConfig.cacheDir, expectedCacheDirPath);
}
} // namespace NEO

View File

@ -16,7 +16,7 @@
namespace NEO {
int64_t defaultCacheEnabled() {
return 0l;
return 1l;
}
std::string getKnownFolderPath(REFKNOWNFOLDERID rfid) {

View File

@ -807,6 +807,10 @@ TEST_F(CompilerCacheWindowsTest, givenCacheBinaryWhenRenameTempFileBinaryToPrope
EXPECT_EQ(0u, SysCalls::writeFileCalled);
}
TEST(CompilerCacheHelperWindowsTest, whenDefaultCacheEnabledIsCalledThenReturnCorrectValue) {
EXPECT_EQ(1l, NEO::defaultCacheEnabled());
}
TEST(CompilerCacheHelperWindowsTest, givenFindFirstFileASuccessWhenGetFileModificationTimeThenFindCloseIsCalled) {
VariableBackup<HANDLE> findFirstFileAResultBackup(&SysCalls::findFirstFileAResult, reinterpret_cast<HANDLE>(0x1234));
VariableBackup<size_t> findCloseCalledBackup(&SysCalls::findCloseCalled, 0u);