Add process safety to cl_cache on Linux

Current flow will be to have one synchronization point
config.file. Read remains unblocking, only write(caching)
operation will be blocking (lock on config.file)

Related-To: NEO-4262

Signed-off-by: Diedrich, Kamil <kamil.diedrich@intel.com>
This commit is contained in:
Diedrich, Kamil
2023-03-08 23:15:36 +01:00
committed by Compute-Runtime-Automation
parent c9fdeb200c
commit 26ca64bb28
15 changed files with 1091 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -15,12 +15,12 @@ class CompilerCacheMock : public CompilerCache {
CompilerCacheMock() : CompilerCache(CompilerCacheConfig{}) {
}
bool cacheBinary(const std::string kernelFileHash, const char *pBinary, uint32_t binarySize) override {
bool cacheBinary(const std::string &kernelFileHash, const char *pBinary, size_t binarySize) override {
cacheInvoked++;
return cacheResult;
}
std::unique_ptr<char[]> loadCachedBinary(const std::string kernelFileHash, size_t &cachedBinarySize) override {
std::unique_ptr<char[]> loadCachedBinary(const std::string &kernelFileHash, size_t &cachedBinarySize) override {
if (loadResult || numberOfLoadResult > 0) {
numberOfLoadResult--;
cachedBinarySize = sizeof(char);