55 *
66 */
77
8- #include " runtime /compiler_interface/binary_cache .h"
8+ #include " core /compiler_interface/compiler_cache .h"
99
1010#include " core/helpers/aligned_memory.h"
1111#include " core/helpers/file_io.h"
1212#include " core/helpers/hash.h"
1313#include " core/utilities/debug_settings_reader.h"
1414#include " runtime/helpers/hw_info.h"
15- #include " runtime/os_interface/ocl_reg_path.h"
16- #include " runtime/os_interface/os_inc_base.h"
1715
1816#include " config.h"
1917#include " os_inc.h"
2523#include < string>
2624
2725namespace NEO {
28- std::mutex BinaryCache ::cacheAccessMtx;
29- const std::string BinaryCache ::getCachedFileName (const HardwareInfo &hwInfo, const ArrayRef<const char > input,
30- const ArrayRef<const char > options, const ArrayRef<const char > internalOptions) {
26+ std::mutex CompilerCache ::cacheAccessMtx;
27+ const std::string CompilerCache ::getCachedFileName (const HardwareInfo &hwInfo, const ArrayRef<const char > input,
28+ const ArrayRef<const char > options, const ArrayRef<const char > internalOptions) {
3129 Hash hash;
3230
3331 hash.update (" ----" , 4 );
@@ -53,26 +51,20 @@ const std::string BinaryCache::getCachedFileName(const HardwareInfo &hwInfo, con
5351 return stream.str ();
5452}
5553
56- BinaryCache::BinaryCache () {
57- std::string keyName = oclRegPath;
58- keyName += " cl_cache_dir" ;
59- std::unique_ptr<SettingsReader> settingsReader (SettingsReader::createOsReader (false , keyName));
60- clCacheLocation = settingsReader->getSetting (settingsReader->appSpecificLocation (keyName), static_cast <std::string>(CL_CACHE_LOCATION));
61- };
54+ CompilerCache::CompilerCache (const CompilerCacheConfig &cacheConfig)
55+ : config(cacheConfig){};
6256
63- BinaryCache::~BinaryCache (){};
64-
65- bool BinaryCache::cacheBinary (const std::string kernelFileHash, const char *pBinary, uint32_t binarySize) {
57+ bool CompilerCache::cacheBinary (const std::string kernelFileHash, const char *pBinary, uint32_t binarySize) {
6658 if (pBinary == nullptr || binarySize == 0 ) {
6759 return false ;
6860 }
69- std::string filePath = clCacheLocation + PATH_SEPARATOR + kernelFileHash + " .cl_cache " ;
61+ std::string filePath = config. cacheDir + PATH_SEPARATOR + kernelFileHash + config. cacheFileExtension ;
7062 std::lock_guard<std::mutex> lock (cacheAccessMtx);
7163 return 0 != writeDataToFile (filePath.c_str (), pBinary, binarySize);
7264}
7365
74- std::unique_ptr<char []> BinaryCache ::loadCachedBinary (const std::string kernelFileHash, size_t &cachedBinarySize) {
75- std::string filePath = clCacheLocation + PATH_SEPARATOR + kernelFileHash + " .cl_cache " ;
66+ std::unique_ptr<char []> CompilerCache ::loadCachedBinary (const std::string kernelFileHash, size_t &cachedBinarySize) {
67+ std::string filePath = config. cacheDir + PATH_SEPARATOR + kernelFileHash + config. cacheFileExtension ;
7668
7769 std::lock_guard<std::mutex> lock (cacheAccessMtx);
7870 return loadDataFromFile (filePath.c_str (), cachedBinarySize);
0 commit comments