mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 00:59:38 +08:00
fix: ocloc - regenerate genHash after compilation
This PR ensures that the genHash will be the same whether the cl_cache is re-used or just created. So it has to be regenerated after compilation to make sure it's created with non NULL irBinary. It also allows to cache debugDataBinary. Minor: Rename NEO_PERSISTENT_CACHE -> NEO_CACHE_PERSISTENT in FAQ, since this version is used in code. Related-To: NEO-8288, NEO-8092 Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
b578e4ad57
commit
1369882b3c
@@ -2521,6 +2521,44 @@ TEST(OfflineCompilerTest, GivenGenBinaryWhenGenerateElfBinaryThenElfIsLoaded) {
|
||||
EXPECT_NE(0u, static_cast<uint32_t>(mockOfflineCompiler->elfBinarySize));
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, givenAllowCachingWhenBuildSourceCodeThenGenBinaryIsCachedUsingHashBasedOnNonNullIrBinary) {
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
"-file",
|
||||
clFiles + "copybuffer.cl",
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str(),
|
||||
"-allow_caching"};
|
||||
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
auto retVal = mockOfflineCompiler->initialize(argv.size(), argv);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto cacheMock = new CompilerCacheMock();
|
||||
mockOfflineCompiler->cache.reset(cacheMock);
|
||||
retVal = mockOfflineCompiler->buildSourceCode();
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler->irBinary);
|
||||
ASSERT_NE(0u, mockOfflineCompiler->irBinarySize);
|
||||
|
||||
// 0 - buildIrBinary > irBinary
|
||||
// 1 - buildSourceCode > irBinary
|
||||
// 2 - buildSourceCode > genBinary
|
||||
// 3 - buildSourceCode > debugDataBinary
|
||||
const auto givenCacheBinaryGenHash = cacheMock->cacheBinaryKernelFileHashes[2];
|
||||
const auto expectedCacheBinaryGenHash = cacheMock->getCachedFileName(mockOfflineCompiler->getHardwareInfo(),
|
||||
ArrayRef<const char>(mockOfflineCompiler->irBinary, mockOfflineCompiler->irBinarySize),
|
||||
mockOfflineCompiler->options,
|
||||
mockOfflineCompiler->internalOptions,
|
||||
std::string(mockOfflineCompiler->igcFacade->getIgcRevision()),
|
||||
mockOfflineCompiler->igcFacade->getIgcLibSize(),
|
||||
mockOfflineCompiler->igcFacade->getIgcLibMTime());
|
||||
|
||||
EXPECT_EQ(expectedCacheBinaryGenHash, givenCacheBinaryGenHash);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, WhenParsingCmdLineThenOptionsAreReadCorrectly) {
|
||||
std::vector<std::string> argv = {
|
||||
"ocloc",
|
||||
|
||||
Reference in New Issue
Block a user