Add cl_cache mechanism to ocloc

Related-To: NEO-6476

Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:
Baj, Tomasz
2022-08-29 09:13:10 +00:00
committed by Compute-Runtime-Automation
parent 4292a47c53
commit 0eab93501c
11 changed files with 357 additions and 66 deletions

View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/compiler_interface/compiler_cache.h"
namespace NEO {
class CompilerCacheMock : public CompilerCache {
public:
CompilerCacheMock() : CompilerCache(CompilerCacheConfig{}) {
}
bool cacheBinary(const std::string kernelFileHash, const char *pBinary, uint32_t binarySize) override {
cacheInvoked++;
return cacheResult;
}
std::unique_ptr<char[]> loadCachedBinary(const std::string kernelFileHash, size_t &cachedBinarySize) override {
if (loadResult || numberOfLoadResult > 0) {
numberOfLoadResult--;
cachedBinarySize = sizeof(char);
return std::unique_ptr<char[]>{new char[1]};
} else
return nullptr;
}
bool cacheResult = false;
uint32_t cacheInvoked = 0u;
bool loadResult = false;
uint32_t numberOfLoadResult = 0u;
};
} // namespace NEO