feature: Add new environment variables for compiler cache

This patch add new environment variables to control compiler cache.
Works as follow: If persistent cache is set driver check if NEO_CACHE_DIR
is set. If not then driver checks XDG_CACHE_HOME - If exists
then driver create neo_compiler_cache folder, if
not then driver checks HOME directory. If each NEO_CACHE_DIR,
XDG_CACHE_HOME and HOME are not set then compiler cache is disabled.
Current support is for Linux only.

Signed-off-by: Diedrich, Kamil <kamil.diedrich@intel.com>

Related-To: NEO-4262
This commit is contained in:
Diedrich, Kamil
2023-05-09 00:39:55 +02:00
committed by Compute-Runtime-Automation
parent 268dcb0777
commit 5a4a2ab8ab
16 changed files with 1257 additions and 585 deletions

View File

@@ -89,8 +89,22 @@ int (*sysCallsScandir)(const char *dirp,
int (*sysCallsUnlink)(const std::string &pathname) = nullptr;
int (*sysCallsStat)(const std::string &filePath, struct stat *statbuf) = nullptr;
int (*sysCallsMkstemp)(char *fileName) = nullptr;
int (*sysCallsMkdir)(const std::string &dir) = nullptr;
bool (*sysCallsPathExists)(const std::string &path) = nullptr;
int mkdir(const std::string &path) {
if (sysCallsMkdir != nullptr) {
return sysCallsMkdir(path);
}
return 0;
}
bool pathExists(const std::string &path) {
if (sysCallsPathExists != nullptr) {
return sysCallsPathExists(path);
}
return pathExistsMock;
}

View File

@@ -16,6 +16,7 @@
namespace NEO {
namespace SysCalls {
extern int (*sysCallsMkdir)(const std::string &dir);
extern int (*sysCallsOpen)(const char *pathname, int flags);
extern int (*sysCallsOpenWithMode)(const char *pathname, int flags, int mode);
extern ssize_t (*sysCallsPread)(int fd, void *buf, size_t count, off_t offset);
@@ -38,6 +39,7 @@ extern int (*sysCallsScandir)(const char *dirp,
extern int (*sysCallsUnlink)(const std::string &pathname);
extern int (*sysCallsStat)(const std::string &filePath, struct stat *statbuf);
extern int (*sysCallsMkstemp)(char *fileName);
extern bool (*sysCallsPathExists)(const std::string &path);
extern int flockRetVal;
extern int closeFuncRetVal;