From 7da55aa651c58ddd7cec1bb176e6782bae134ccd Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 13 Apr 2018 16:58:43 +0100 Subject: COMPMID-959: Add accessors for the OpenCL program cache Change-Id: I7920ecdf6687341cbcf4d75aecc15c4164c64636 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/127722 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/CL/CLKernelLibrary.h | 22 ++++++++++++++-------- src/core/CL/CLKernelLibrary.cpp | 5 +++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/arm_compute/core/CL/CLKernelLibrary.h b/arm_compute/core/CL/CLKernelLibrary.h index 12e424fce9..257ef7ded2 100644 --- a/arm_compute/core/CL/CLKernelLibrary.h +++ b/arm_compute/core/CL/CLKernelLibrary.h @@ -283,14 +283,6 @@ public: * @return The created kernel. */ Kernel create_kernel(const std::string &kernel_name, const StringSet &build_options_set = {}) const; - /** Serializes and saves programs to a binary. - * - */ - void save_binary(); - /** Load serialized binary with all the programs. - * - */ - void load_binary(); /** Find the maximum number of local work items in a workgroup can be supported for the kernel. * */ @@ -308,6 +300,20 @@ public: _built_programs_map.clear(); } + /** Access the cache of built OpenCL programs + */ + const std::map &get_built_programs() const + { + return _built_programs_map; + } + + /** Add a new built program to the cache + * + * @param[in] built_program_name Name of the program + * @param[in] program Built program to add to the cache + */ + void add_built_program(const std::string &built_program_name, cl::Program program); + private: /** Load program and its dependencies. * diff --git a/src/core/CL/CLKernelLibrary.cpp b/src/core/CL/CLKernelLibrary.cpp index ad028ec5e8..48316ce991 100644 --- a/src/core/CL/CLKernelLibrary.cpp +++ b/src/core/CL/CLKernelLibrary.cpp @@ -771,6 +771,11 @@ Kernel CLKernelLibrary::create_kernel(const std::string &kernel_name, const Stri return Kernel(kernel_name, cl_program); } +void CLKernelLibrary::add_built_program(const std::string &built_program_name, cl::Program program) +{ + _built_programs_map.emplace(built_program_name, program); +} + const Program &CLKernelLibrary::load_program(const std::string &program_name) const { const auto program_it = _programs_map.find(program_name); -- cgit v1.2.1