From f726fbdc9fef937fbe32222f0e66aac8d7e2678c Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sat, 18 Jun 2016 20:20:13 +0200 Subject: Moved all headers into the source tree, changed headers to .hpp extension --- include/internal/cache.h | 98 ------------------------------------------------ 1 file changed, 98 deletions(-) delete mode 100644 include/internal/cache.h (limited to 'include/internal/cache.h') diff --git a/include/internal/cache.h b/include/internal/cache.h deleted file mode 100644 index bc7e87d9..00000000 --- a/include/internal/cache.h +++ /dev/null @@ -1,98 +0,0 @@ - -// ================================================================================================= -// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This -// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- -// width of 100 characters per line. -// -// Author(s): -// Cedric Nugteren -// -// This file implements the caching functionality of compiled binaries and programs. -// -// ================================================================================================= - -#ifndef CLBLAST_CACHE_H_ -#define CLBLAST_CACHE_H_ - -#include -#include -#include - -#include "internal/utilities.h" - -namespace clblast { -// ================================================================================================= - -// The cache of compiled OpenCL binaries, along with some meta-data -struct BinaryCache { - std::string binary; - std::string device_name; - Precision precision; - std::string routine_name_; - - // Finds out whether the properties match - bool MatchInCache(const std::string &ref_device, const Precision &ref_precision, - const std::string &ref_routine) { - return (device_name == ref_device && - precision == ref_precision && - routine_name_ == ref_routine); - } -}; - -// The actual cache, implemented as a vector of the above data-type, and its mutex -static std::vector binary_cache_; -static std::mutex binary_cache_mutex_; - -// ================================================================================================= - -// The cache of compiled OpenCL programs, along with some meta-data -struct ProgramCache { - Program program; - ContextPointer context_ptr; - Precision precision; - std::string routine_name_; - - // Finds out whether the properties match - bool MatchInCache(const ContextPointer ref_context, const Precision &ref_precision, - const std::string &ref_routine) { - return (context_ptr == ref_context && - precision == ref_precision && - routine_name_ == ref_routine); - } -}; - -// The actual cache, implemented as a vector of the above data-type, and its mutex -static std::vector program_cache_; -static std::mutex program_cache_mutex_; - -// ================================================================================================= - -// Stores the compiled binary or program in the cache -void StoreBinaryToCache(const std::string &binary, const std::string &device_name, - const Precision &precision, const std::string &routine_name); -void StoreProgramToCache(const Program &program, const Context &context, - const Precision &precision, const std::string &routine_name); - -// Queries the cache and retrieves a matching binary or program. Assumes that the match is -// available, throws otherwise. -const std::string& GetBinaryFromCache(const std::string &device_name, const Precision &precision, - const std::string &routine_name); -const Program& GetProgramFromCache(const Context &context, const Precision &precision, - const std::string &routine_name); - -// Queries the cache to see whether or not the compiled kernel is already there -bool BinaryIsInCache(const std::string &device_name, const Precision &precision, - const std::string &routine_name); -bool ProgramIsInCache(const Context &context, const Precision &precision, - const std::string &routine_name); - -// ================================================================================================= - -// Clears the cache of stored binaries -StatusCode CacheClearAll(); - -// ================================================================================================= -} // namespace clblast - -// CLBLAST_CACHE_H_ -#endif -- cgit v1.2.3