mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 12:42:54 +08:00
Add cl_cache mechanism to ocloc
Related-To: NEO-6476 Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4292a47c53
commit
0eab93501c
37
shared/test/common/mocks/mock_compiler_cache.h
Normal file
37
shared/test/common/mocks/mock_compiler_cache.h
Normal 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
|
||||
Reference in New Issue
Block a user