Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
StorageCache.hpp
Go to the documentation of this file.
1//===-- StorageCache.hpp -- Storage cache header --===//
2//
3// Part of the Proteus Project, under the Apache License v2.0 with LLVM
4// Exceptions. See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef PROTEUS_JITSTOREDCACHE_HPP
12#define PROTEUS_JITSTOREDCACHE_HPP
13
16#include "proteus/Hashing.hpp"
17
18#include <llvm/Support/MemoryBufferRef.h>
19
20#include <cstdint>
21namespace proteus {
22
23using namespace llvm;
24
25// NOTE: Storage cache assumes that stored code is re-usable across runs!
26// TODO: Source code changes should invalidate the cache. Also, if storing
27// assembly (PTX) or binary (ELF), then device globals may have different
28// addresses that render it invalid. In this case, store LLVM IR to re-link
29// globals.
30class StorageCache : public ObjectCache {
31public:
32 StorageCache(const std::string &Label);
33
34 std::string getName() const override { return "Storage"; }
35
36 std::unique_ptr<CompiledLibrary> lookup(const HashT &HashValue) override;
37
38 void store(const HashT &HashValue, const CacheEntry &Entry) override;
39
40 void printStats() override;
41
42 uint64_t getHits() const override { return Hits; }
43
44 uint64_t getAccesses() const override { return Accesses; }
45
46private:
47 uint64_t Hits = 0;
48 uint64_t Accesses = 0;
49 const std::string StorageDirectory;
50 const std::string Label;
51 const std::string DistributedRank;
52};
53
54} // namespace proteus
55
56#endif
Definition Hashing.hpp:21
Definition ObjectCache.hpp:39
Definition StorageCache.hpp:30
uint64_t getAccesses() const override
Definition StorageCache.hpp:44
std::unique_ptr< CompiledLibrary > lookup(const HashT &HashValue) override
Definition StorageCache.cpp:41
void printStats() override
Definition StorageCache.cpp:76
std::string getName() const override
Definition StorageCache.hpp:34
uint64_t getHits() const override
Definition StorageCache.hpp:42
void store(const HashT &HashValue, const CacheEntry &Entry) override
Definition StorageCache.cpp:65
Definition Helpers.h:141
Definition ObjectCacheChain.cpp:26
Definition ObjectCache.hpp:27