fix: extend cache hash with compiler commit sha, lib size and mtime

Related-To: NEO-4262

Signed-off-by: Kacper Kasper <kacper.k.kasper@intel.com>
This commit is contained in:
Kacper Kasper
2023-08-21 12:00:06 +00:00
committed by Compute-Runtime-Automation
parent d49190f4ae
commit 991febcdf4
35 changed files with 240 additions and 26 deletions

View File

@@ -10,9 +10,11 @@
#include "shared/offline_compiler/source/ocloc_arg_helper.h"
#include "shared/offline_compiler/source/ocloc_error_code.h"
#include "shared/source/compiler_interface/igc_platform_helper.h"
#include "shared/source/compiler_interface/os_compiler_cache_helper.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/debug_helpers.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h"
#include "shared/source/os_interface/os_inc_base.h"
#include "shared/source/os_interface/os_library.h"
@@ -37,6 +39,10 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
return OclocErrorCode::OUT_OF_HOST_MEMORY;
}
std::string igcPath = igcLib->getFullPath();
igcLibSize = NEO::getFileSize(igcPath);
igcLibMTime = NEO::getFileModificationTime(igcPath);
const auto igcCreateMainFunction = loadCreateIgcMainFunction();
if (!igcCreateMainFunction) {
argHelper->printf("Error! Cannot load required functions from IGC library.\n");
@@ -63,6 +69,16 @@ int OclocIgcFacade::initialize(const HardwareInfo &hwInfo) {
return OclocErrorCode::OUT_OF_HOST_MEMORY;
}
{
auto igcDeviceCtx3 = igcMain->CreateInterface<IGC::IgcOclDeviceCtx<3>>();
if (igcDeviceCtx3) {
const char *revision = igcDeviceCtx3->GetIGCRevision();
// revision is sha-1 hash
igcRevision.resize(41);
strncpy_s(igcRevision.data(), 41, revision, 40);
}
}
igcDeviceCtx = createIgcDeviceContext();
if (!igcDeviceCtx) {
argHelper->printf("Error! Cannot create IGC device context!\n");
@@ -140,6 +156,18 @@ void OclocIgcFacade::populateWithFeatures(IGC::IgcFeaturesAndWorkaroundsTagOCL *
handle->SetFtrPooledEuEnabled(hwInfo.featureTable.flags.ftrPooledEuEnabled);
}
const char *OclocIgcFacade::getIgcRevision() {
return igcRevision.data();
}
size_t OclocIgcFacade::getIgcLibSize() {
return igcLibSize;
}
time_t OclocIgcFacade::getIgcLibMTime() {
return igcLibMTime;
}
CIF::RAII::UPtr_t<CIF::Builtins::BufferLatest> OclocIgcFacade::createConstBuffer(const void *data, size_t size) {
return CIF::Builtins::CreateConstBuffer(igcMain.get(), data, size);
}