Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
StorageCache.h
Go to the documentation of this file.
1//===-- StorageCache.h -- 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_H
12#define PROTEUS_JITSTOREDCACHE_H
13
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
46 void finalize() override {}
47
48private:
49 uint64_t Hits = 0;
50 uint64_t Accesses = 0;
51 const std::string StorageDirectory;
52 const std::string Label;
53 const std::string DistributedRank;
54};
55
56} // namespace proteus
57
58#endif
Definition Hashing.h:21
Definition ObjectCache.h:39
Definition StorageCache.h:30
uint64_t getAccesses() const override
Definition StorageCache.h: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.h:34
uint64_t getHits() const override
Definition StorageCache.h:42
void store(const HashT &HashValue, const CacheEntry &Entry) override
Definition StorageCache.cpp:65
void finalize() override
Definition StorageCache.h:46
Definition CompiledLibrary.h:7
Definition MemoryCache.h:26
Definition ObjectCache.h:27