Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Main Page
Namespaces
Classes
Files
File List
File Members
Loading...
Searching...
No Matches
include
proteus
Caching
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
14
#include "
proteus/Caching/ObjectCache.hpp
"
15
#include "
proteus/CompiledLibrary.hpp
"
16
#include "
proteus/Hashing.hpp
"
17
18
#include <llvm/Support/MemoryBufferRef.h>
19
20
#include <cstdint>
21
namespace
proteus
{
22
23
using 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.
30
class
StorageCache
:
public
ObjectCache
{
31
public
:
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
private
:
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
CompiledLibrary.hpp
Hashing.hpp
ObjectCache.hpp
proteus::HashT
Definition
Hashing.hpp:21
proteus::ObjectCache
Definition
ObjectCache.hpp:39
proteus::StorageCache
Definition
StorageCache.hpp:30
proteus::StorageCache::getAccesses
uint64_t getAccesses() const override
Definition
StorageCache.hpp:44
proteus::StorageCache::lookup
std::unique_ptr< CompiledLibrary > lookup(const HashT &HashValue) override
Definition
StorageCache.cpp:41
proteus::StorageCache::printStats
void printStats() override
Definition
StorageCache.cpp:76
proteus::StorageCache::getName
std::string getName() const override
Definition
StorageCache.hpp:34
proteus::StorageCache::getHits
uint64_t getHits() const override
Definition
StorageCache.hpp:42
proteus::StorageCache::store
void store(const HashT &HashValue, const CacheEntry &Entry) override
Definition
StorageCache.cpp:65
llvm
Definition
Helpers.h:141
proteus
Definition
ObjectCacheChain.cpp:26
proteus::CacheEntry
Definition
ObjectCache.hpp:27
Generated by
1.9.8