Tensor Comprehensions
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tc::OptionsCache Class Reference

#include <compilation_cache.h>

Inheritance diagram for tc::OptionsCache:
Collaboration diagram for tc::OptionsCache:

Classes

struct  CachedEntry
 
struct  RetrievalResult
 

Public Member Functions

 OptionsCache ()=default
 
 OptionsCache (const OptionsCacheProto &buf)
 
decltype(entries_)::const_iterator begin () const
 
decltype(entries_)::const_iterator end () const
 
OptionsCacheProto toProtobuf () const
 
size_t totalSize () const
 
void recordRuntime (const std::string &id, const MappingOptions &options, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs, Duration runtime)
 
std::vector< RetrievalResultretrieveOptionsAndRuntimes (const std::string &id, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs) const
 
std::unique_ptr< MappingOptionsretrieveBestOptions (const std::string &id, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs) const
 
std::vector< MappingOptionsretrieveTopKOptions (const std::string &id, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs, size_t k) const
 
void keepOnlyBestCandidates (size_t numberToKeep)
 
- Public Member Functions inherited from tc::Cache< OptionsCache >
size_t size () const
 
void clear ()
 

Private Types

using Protobuf = OptionsCacheProto
 

Private Member Functions

CachedEntrysearchKernel (const std::string &id, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs)
 
const CachedEntrysearchKernel (const std::string &id, const std::vector< const DLTensor * > &input, const std::vector< const DLTensor * > &outputs) const
 

Static Private Member Functions

static std::shared_ptr
< OptionsCache > & 
getGlobalSharedCache ()
 
template<typename C >
static auto searchKernelImpl (C &c, const std::string &id, const std::vector< const DLTensor * > &inputs, const std::vector< const DLTensor * > &outputs) -> decltype(c.searchKernel(id, inputs, outputs))
 

Private Attributes

std::vector< CachedEntryentries_
 

Friends

class Cache< OptionsCache >
 

Additional Inherited Members

- Static Public Member Functions inherited from tc::Cache< OptionsCache >
static void enableCache ()
 
static void disableCache ()
 
static void dumpCacheToProtobuf (const std::string &filename)
 
static void loadCacheFromProtobuf (const std::string &filename)
 
static void loadCacheFromProtobuf (const Protobuf &buf)
 
static std::shared_ptr
< OptionsCache
getCache ()
 
static bool cacheEnabled ()
 
- Public Attributes inherited from tc::Cache< OptionsCache >
int numberAttemptedRetrievals
 
int numberSuccessfulRetrievals
 
int numberCacheAttemps
 
- Protected Attributes inherited from tc::Cache< OptionsCache >
std::mutex mtx_
 

Member Typedef Documentation

using tc::OptionsCache::Protobuf = OptionsCacheProto
private

Constructor & Destructor Documentation

tc::OptionsCache::OptionsCache ( )
default
tc::OptionsCache::OptionsCache ( const OptionsCacheProto &  buf)

Member Function Documentation

decltype(entries_) ::const_iterator tc::OptionsCache::begin ( ) const
decltype(entries_) ::const_iterator tc::OptionsCache::end ( ) const
static std::shared_ptr<OptionsCache>& tc::OptionsCache::getGlobalSharedCache ( )
staticprivate
void tc::OptionsCache::keepOnlyBestCandidates ( size_t  numberToKeep)
void tc::OptionsCache::recordRuntime ( const std::string &  id,
const MappingOptions options,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs,
Duration  runtime 
)
std::unique_ptr<MappingOptions> tc::OptionsCache::retrieveBestOptions ( const std::string &  id,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs 
) const
std::vector<RetrievalResult> tc::OptionsCache::retrieveOptionsAndRuntimes ( const std::string &  id,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs 
) const
std::vector<MappingOptions> tc::OptionsCache::retrieveTopKOptions ( const std::string &  id,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs,
size_t  k 
) const
CachedEntry* tc::OptionsCache::searchKernel ( const std::string &  id,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs 
)
private

SearchKernel (through SearchKernelImpl) searches op in the cache if a cached entry that corresponds to the op's configuration (MappingOptions and TargetDevice) and the shape of inputs matches it is returned

const CachedEntry* tc::OptionsCache::searchKernel ( const std::string &  id,
const std::vector< const DLTensor * > &  input,
const std::vector< const DLTensor * > &  outputs 
) const
private
template<typename C >
auto tc::OptionsCache::searchKernelImpl ( C &  c,
const std::string &  id,
const std::vector< const DLTensor * > &  inputs,
const std::vector< const DLTensor * > &  outputs 
) -> decltype(c.searchKernel(id, inputs, outputs))
staticprivate
OptionsCacheProto tc::OptionsCache::toProtobuf ( ) const
size_t tc::OptionsCache::totalSize ( ) const

Friends And Related Function Documentation

friend class Cache< OptionsCache >
friend

Member Data Documentation

std::vector<CachedEntry> tc::OptionsCache::entries_
private

The documentation for this class was generated from the following files: