Files
compute-runtime/shared/source/compiler_interface/compiler_cache.h
Warchulski, Jaroslaw 7ae44268cb Cleanup includes 17
Cleaned up files:
shared/source/built_ins/sip.h
shared/source/compiler_interface/compiler_cache.h
shared/source/compiler_interface/compiler_interface.h
shared/source/device_binary_format/device_binary_formats.h
shared/source/helpers/timestamp_packet.h
shared/source/kernel/debug_data.h
shared/source/utilities/tag_allocator.h
shared/test/common/mocks/mock_device.h

Related-To: NEO-5548
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
2023-01-02 10:59:08 +01:00

47 lines
1.2 KiB
C++

/*
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/utilities/arrayref.h"
#include <cstdint>
#include <memory>
#include <mutex>
#include <string>
namespace NEO {
struct HardwareInfo;
struct CompilerCacheConfig {
bool enabled = true;
std::string cacheFileExtension;
std::string cacheDir;
};
class CompilerCache {
public:
CompilerCache(const CompilerCacheConfig &config);
virtual ~CompilerCache() = default;
CompilerCache(const CompilerCache &) = delete;
CompilerCache(CompilerCache &&) = delete;
CompilerCache &operator=(const CompilerCache &) = delete;
CompilerCache &operator=(CompilerCache &&) = delete;
const std::string getCachedFileName(const HardwareInfo &hwInfo, ArrayRef<const char> input,
ArrayRef<const char> options, ArrayRef<const char> internalOptions);
MOCKABLE_VIRTUAL bool cacheBinary(const std::string kernelFileHash, const char *pBinary, uint32_t binarySize);
MOCKABLE_VIRTUAL std::unique_ptr<char[]> loadCachedBinary(const std::string kernelFileHash, size_t &cachedBinarySize);
protected:
static std::mutex cacheAccessMtx;
CompilerCacheConfig config;
};
} // namespace NEO