diff options
author | Pablo Tello <pablo.tello@arm.com> | 2019-09-24 11:03:47 +0100 |
---|---|---|
committer | Pablo Marquez <pablo.tello@arm.com> | 2019-10-15 14:05:55 +0000 |
commit | db8485ac24135f17e9882c76196924435abc064f (patch) | |
tree | dfe4ff6a50012ac93c6b1cf3fb29c099a7592522 /arm_compute/core/CL/CLKernelLibrary.h | |
parent | a046e164b96a8441b2fa14ef578f7db46a0e97da (diff) | |
download | ComputeLibrary-db8485ac24135f17e9882c76196924435abc064f.tar.gz |
COMPMID-2205: CL runtime context.
CL Interfaces implemented.
Concrete classes implemented.
One test (ActivationLayer) ported to the new interface.
Change-Id: I283808bec36ccfc2f13fe048c45cbbee698ce525
Signed-off-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-on: https://review.mlplatform.org/c/1998
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/CL/CLKernelLibrary.h')
-rw-r--r-- | arm_compute/core/CL/CLKernelLibrary.h | 78 |
1 files changed, 15 insertions, 63 deletions
diff --git a/arm_compute/core/CL/CLKernelLibrary.h b/arm_compute/core/CL/CLKernelLibrary.h index 9f183f1232..f2282692f9 100644 --- a/arm_compute/core/CL/CLKernelLibrary.h +++ b/arm_compute/core/CL/CLKernelLibrary.h @@ -34,7 +34,7 @@ namespace arm_compute { /** Build options */ -class CLBuildOptions +class CLBuildOptions final { using StringSet = std::set<std::string>; @@ -80,7 +80,7 @@ private: StringSet _build_opts; /**< Build options set */ }; /** Program class */ -class Program +class Program final { public: /** Default constructor. */ @@ -147,7 +147,7 @@ private: }; /** Kernel class */ -class Kernel +class Kernel final { public: /** Default Constructor. */ @@ -189,20 +189,19 @@ private: }; /** CLKernelLibrary class */ -class CLKernelLibrary +class CLKernelLibrary final { using StringSet = std::set<std::string>; -private: +public: /** Default Constructor. */ CLKernelLibrary(); - -public: /** Prevent instances of this class from being copied */ CLKernelLibrary(const CLKernelLibrary &) = delete; /** Prevent instances of this class from being copied */ const CLKernelLibrary &operator=(const CLKernelLibrary &) = delete; /** Access the KernelLibrary singleton. + * This method has been deprecated and will be removed in the next release. * @return The KernelLibrary instance. */ static CLKernelLibrary &get(); @@ -212,26 +211,15 @@ public: * @param[in] context CL context used to create programs. * @param[in] device CL device for which the programs are created. */ - void init(std::string kernel_path, cl::Context context, cl::Device device) - { - _kernel_path = std::move(kernel_path); - _context = std::move(context); - _device = std::move(device); - } + void init(std::string kernel_path, cl::Context context, cl::Device device); /** Sets the path that the kernels reside in. * * @param[in] kernel_path Path of the kernel. */ - void set_kernel_path(const std::string &kernel_path) - { - _kernel_path = kernel_path; - }; + void set_kernel_path(const std::string &kernel_path); /** Gets the path that the kernels reside in. */ - std::string get_kernel_path() - { - return _kernel_path; - }; + std::string get_kernel_path(); /** Gets the source of the selected program. * * @param[in] program_name Program name. @@ -246,51 +234,22 @@ public: * * @param[in] context A CL context. */ - void set_context(cl::Context context) - { - _context = std::move(context); - if(_context.get() == nullptr) - { - _device = cl::Device(); - } - else - { - const auto cl_devices = _context.getInfo<CL_CONTEXT_DEVICES>(); - - if(cl_devices.empty()) - { - _device = cl::Device(); - } - else - { - _device = cl_devices[0]; - } - } - } + void set_context(cl::Context context); /** Accessor for the associated CL context. * * @return A CL context. */ - cl::Context &context() - { - return _context; - } + cl::Context &context(); /** Gets the CL device for which the programs are created. */ - cl::Device &get_device() - { - return _device; - } + cl::Device &get_device(); /** Sets the CL device for which the programs are created. * * @param[in] device A CL device. */ - void set_device(cl::Device device) - { - _device = std::move(device); - } + void set_device(cl::Device device); /** Return the device version * @@ -321,17 +280,10 @@ public: /** Clear the library's cache of binary programs */ - void clear_programs_cache() - { - _programs_map.clear(); - _built_programs_map.clear(); - } + void clear_programs_cache(); /** Access the cache of built OpenCL programs */ - const std::map<std::string, cl::Program> &get_built_programs() const - { - return _built_programs_map; - } + const std::map<std::string, cl::Program> &get_built_programs() const; /** Add a new built program to the cache * |