DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::KernelProgramCache Class Reference

#include <detail/kernel_program_cache.hpp>

Classes

struct  BuildError
 Denotes build error data. More...
 
struct  BuildResult
 Denotes pointer to some entity with its general state and build error. More...
 
struct  ProgramCache
 

Public Types

enum  BuildState { BS_InProgress, BS_Done, BS_Failed }
 Denotes the state of a build. More...
 
using ProgramWithBuildStateT = BuildResult< RT::PiProgram >
 
using ProgramCacheKeyT = std::pair< std::pair< SerializedObj, std::uintptr_t >, std::pair< RT::PiDevice, std::string > >
 
using CommonProgramKeyT = std::pair< std::uintptr_t, RT::PiDevice >
 
using ContextPtr = context_impl *
 
using KernelArgMaskPairT = std::pair< RT::PiKernel, const KernelArgMask * >
 
using KernelByNameT = std::map< std::string, BuildResult< KernelArgMaskPairT > >
 
using KernelCacheT = std::map< RT::PiProgram, KernelByNameT >
 
using KernelFastCacheKeyT = std::tuple< SerializedObj, OSModuleHandle, RT::PiDevice, std::string, std::string >
 
using KernelFastCacheValT = std::tuple< RT::PiKernel, std::mutex *, const KernelArgMask *, RT::PiProgram >
 
using KernelFastCacheT = std::map< KernelFastCacheKeyT, KernelFastCacheValT >
 

Public Member Functions

 ~KernelProgramCache ()
 
void setContextPtr (const ContextPtr &AContext)
 
Locked< ProgramCacheacquireCachedPrograms ()
 
Locked< KernelCacheTacquireKernelsPerProgramCache ()
 
std::pair< ProgramWithBuildStateT *, bool > getOrInsertProgram (const ProgramCacheKeyT &CacheKey)
 
std::pair< BuildResult< KernelArgMaskPairT > *, bool > getOrInsertKernel (RT::PiProgram Program, const std::string &KernelName)
 
template<typename T , class Predicate >
void waitUntilBuilt (BuildResult< T > &BR, Predicate Pred) const
 
template<typename ExceptionT , typename RetT >
RetT * waitUntilBuilt (BuildResult< RetT > *BuildResult)
 
template<typename T >
void notifyAllBuild (BuildResult< T > &BR) const
 
template<typename KeyT >
KernelFastCacheValT tryToGetKernelFast (KeyT &&CacheKey)
 
template<typename KeyT , typename ValT >
void saveKernel (KeyT &&CacheKey, ValT &&CacheVal)
 
void reset ()
 Clears cache state. More...
 

Friends

class ::MockKernelProgramCache
 

Detailed Description

Definition at line 32 of file kernel_program_cache.hpp.

Member Typedef Documentation

◆ CommonProgramKeyT

using sycl::_V1::detail::KernelProgramCache::CommonProgramKeyT = std::pair<std::uintptr_t, RT::PiDevice>

Definition at line 76 of file kernel_program_cache.hpp.

◆ ContextPtr

◆ KernelArgMaskPairT

Definition at line 87 of file kernel_program_cache.hpp.

◆ KernelByNameT

◆ KernelCacheT

Definition at line 89 of file kernel_program_cache.hpp.

◆ KernelFastCacheKeyT

using sycl::_V1::detail::KernelProgramCache::KernelFastCacheKeyT = std::tuple<SerializedObj, OSModuleHandle, RT::PiDevice, std::string, std::string>

Definition at line 93 of file kernel_program_cache.hpp.

◆ KernelFastCacheT

◆ KernelFastCacheValT

using sycl::_V1::detail::KernelProgramCache::KernelFastCacheValT = std::tuple<RT::PiKernel, std::mutex *, const KernelArgMask *, RT::PiProgram>

Definition at line 95 of file kernel_program_cache.hpp.

◆ ProgramCacheKeyT

using sycl::_V1::detail::KernelProgramCache::ProgramCacheKeyT = std::pair<std::pair<SerializedObj, std::uintptr_t>, std::pair<RT::PiDevice, std::string> >

Definition at line 75 of file kernel_program_cache.hpp.

◆ ProgramWithBuildStateT

Member Enumeration Documentation

◆ BuildState

Denotes the state of a build.

Enumerator
BS_InProgress 
BS_Done 
BS_Failed 

Definition at line 44 of file kernel_program_cache.hpp.

Constructor & Destructor Documentation

◆ ~KernelProgramCache()

sycl::_V1::detail::KernelProgramCache::~KernelProgramCache ( )

Member Function Documentation

◆ acquireCachedPrograms()

Locked<ProgramCache> sycl::_V1::detail::KernelProgramCache::acquireCachedPrograms ( )
inline

◆ acquireKernelsPerProgramCache()

Locked<KernelCacheT> sycl::_V1::detail::KernelProgramCache::acquireKernelsPerProgramCache ( )
inline

Definition at line 106 of file kernel_program_cache.hpp.

◆ getOrInsertKernel()

std::pair<BuildResult<KernelArgMaskPairT> *, bool> sycl::_V1::detail::KernelProgramCache::getOrInsertKernel ( RT::PiProgram  Program,
const std::string &  KernelName 
)
inline

◆ getOrInsertProgram()

std::pair<ProgramWithBuildStateT *, bool> sycl::_V1::detail::KernelProgramCache::getOrInsertProgram ( const ProgramCacheKeyT CacheKey)
inline

◆ notifyAllBuild()

template<typename T >
void sycl::_V1::detail::KernelProgramCache::notifyAllBuild ( BuildResult< T > &  BR) const
inline

Definition at line 162 of file kernel_program_cache.hpp.

Referenced by sycl::_V1::detail::getOrBuild().

◆ reset()

void sycl::_V1::detail::KernelProgramCache::reset ( )
inline

Clears cache state.

This member function should only be used in unit tests.

Definition at line 187 of file kernel_program_cache.hpp.

◆ saveKernel()

template<typename KeyT , typename ValT >
void sycl::_V1::detail::KernelProgramCache::saveKernel ( KeyT &&  CacheKey,
ValT &&  CacheVal 
)
inline

◆ setContextPtr()

void sycl::_V1::detail::KernelProgramCache::setContextPtr ( const ContextPtr AContext)
inline

◆ tryToGetKernelFast()

template<typename KeyT >
KernelFastCacheValT sycl::_V1::detail::KernelProgramCache::tryToGetKernelFast ( KeyT &&  CacheKey)
inline

◆ waitUntilBuilt() [1/2]

◆ waitUntilBuilt() [2/2]

template<typename T , class Predicate >
void sycl::_V1::detail::KernelProgramCache::waitUntilBuilt ( BuildResult< T > &  BR,
Predicate  Pred 
) const
inline

Friends And Related Function Documentation

◆ ::MockKernelProgramCache

friend class ::MockKernelProgramCache
friend

Definition at line 203 of file kernel_program_cache.hpp.


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