ONE - On-device Neural Engine
|
Class to build OpenCL kernels added from nnfw. More...
#include <CLKernelLibraryEx.h>
Public Member Functions | |
CLKernelLibraryEx (const CLKernelLibraryEx &)=delete | |
Prevent instances of this class from being copied. | |
const CLKernelLibraryEx & | operator= (const CLKernelLibraryEx &)=delete |
Prevent instances of this class from being copied. | |
void | init (std::string kernel_path, cl::Context context, cl::Device device) |
Initialise the kernel library. | |
void | set_kernel_path (const std::string &kernel_path) |
Set the path that the kernels reside in. | |
std::string | get_kernel_path () |
Get the path that the kernels reside in. | |
std::string | get_program_source (const std::string &program_name) |
Get the source of the selected program. | |
void | set_context (cl::Context context) |
Set the CL context used to create programs. | |
cl::Context & | context () |
Return associated CL context. | |
void | set_device (cl::Device device) |
Set the CL device for which the programs are created. | |
cl::Device & | get_device () |
Gets the CL device for which the programs are created. | |
std::string | get_device_version () |
Return the device version. | |
Kernel | create_kernel (const std::string &kernel_name, const StringSet &build_options_set={}) const |
Create a kernel from the kernel library. | |
size_t | max_local_workgroup_size (const cl::Kernel &kernel) const |
Find the maximum number of local work items in a workgroup can be supported for the kernel. | |
cl::NDRange | default_ndrange () const |
Return the default NDRange for the device. | |
void | clear_programs_cache () |
Clear the library's cache of binary programs. | |
const std::map< std::string, cl::Program > & | get_built_programs () const |
Access the cache of built OpenCL programs. | |
void | add_built_program (const std::string &built_program_name, cl::Program program) |
Add a new built program to the cache. | |
bool | fp16_supported () const |
Returns true if FP16 is supported by the CL device. | |
bool | int64_base_atomics_supported () const |
Returns true if int64_base_atomics extension is supported by the CL device. | |
Static Public Member Functions | |
static CLKernelLibraryEx & | get () |
Get the KernelLibrary singleton. | |
Class to build OpenCL kernels added from nnfw.
Definition at line 64 of file CLKernelLibraryEx.h.
|
delete |
Prevent instances of this class from being copied.
void CLKernelLibraryEx::add_built_program | ( | const std::string & | built_program_name, |
cl::Program | program | ||
) |
Add a new built program to the cache.
[in] | built_program_name | Name of the program |
[in] | program | Built program to add to the cache |
Definition at line 261 of file CLKernelLibrary.cpp.
|
inline |
Clear the library's cache of binary programs.
Definition at line 205 of file CLKernelLibraryEx.h.
|
inline |
Return associated CL context.
Definition at line 158 of file CLKernelLibraryEx.h.
Referenced by init(), and set_context().
Kernel CLKernelLibraryEx::create_kernel | ( | const std::string & | kernel_name, |
const StringSet & | build_options_set = {} |
||
) | const |
Create a kernel from the kernel library.
[in] | kernel_name | Kernel name. |
[in] | build_options_set | Kernel build options as a set. |
Definition at line 201 of file CLKernelLibrary.cpp.
References fp16_supported().
Referenced by arm_compute::CLPadLayerKernelEx::configure(), arm_compute::CLGEMMMatrixAccumulateBiasesKernel::configure(), arm_compute::CLMemsetKernel::configure(), arm_compute::CLGatherExKernel::configure(), arm_compute::CLQuantizationSymmetricKernel::configure(), arm_compute::CLMultiplyScaleFactorKernel::configure(), arm_compute::CLCastBoolKernel::configure(), arm_compute::CLNegKernel::configure(), arm_compute::CLScaleFactorSymm8Kernel::configure(), arm_compute::CLEmbeddingLookupKernel::configure(), arm_compute::CLReduceOperationKernel::configure(), arm_compute::CLBinaryLogicalOpKernel::configure(), arm_compute::CLHashtableLookupKernel::configure(), and arm_compute::CLInstanceNormalizationLayerKernelEx::configure().
cl::NDRange CLKernelLibraryEx::default_ndrange | ( | ) | const |
Return the default NDRange for the device.
Definition at line 363 of file CLKernelLibrary.cpp.
bool CLKernelLibraryEx::fp16_supported | ( | ) | const |
Returns true if FP16 is supported by the CL device.
Definition at line 267 of file CLKernelLibrary.cpp.
Referenced by create_kernel().
|
static |
Get the KernelLibrary singleton.
Definition at line 195 of file CLKernelLibrary.cpp.
Referenced by arm_compute::CLPadLayerKernelEx::configure(), arm_compute::CLGEMMMatrixAccumulateBiasesKernel::configure(), arm_compute::CLMemsetKernel::configure(), arm_compute::CLGatherExKernel::configure(), arm_compute::CLQuantizationSymmetricKernel::configure(), arm_compute::CLMultiplyScaleFactorKernel::configure(), arm_compute::CLCastBoolKernel::configure(), arm_compute::CLNegKernel::configure(), arm_compute::CLScaleFactorSymm8Kernel::configure(), arm_compute::CLEmbeddingLookupKernel::configure(), arm_compute::CLReduceOperationKernel::configure(), arm_compute::CLBinaryLogicalOpKernel::configure(), arm_compute::CLHashtableLookupKernel::configure(), arm_compute::CLInstanceNormalizationLayerKernelEx::configure(), and onert::backend::acl_cl::Config::initialize().
|
inline |
Access the cache of built OpenCL programs.
Definition at line 216 of file CLKernelLibraryEx.h.
|
inline |
Gets the CL device for which the programs are created.
Definition at line 171 of file CLKernelLibraryEx.h.
std::string CLKernelLibraryEx::get_device_version | ( | ) |
Return the device version.
Definition at line 385 of file CLKernelLibrary.cpp.
|
inline |
Get the path that the kernels reside in.
Definition at line 116 of file CLKernelLibraryEx.h.
std::string CLKernelLibraryEx::get_program_source | ( | const std::string & | program_name | ) |
Get the source of the selected program.
[in] | program_name | Program name. |
Definition at line 338 of file CLKernelLibrary.cpp.
|
inline |
Initialise the kernel library.
[in] | kernel_path | Path of the directory from which kernel sources are loaded. |
[in] | context | CL context used to create programs. |
[in] | device | CL device for which the programs are created. |
Definition at line 98 of file CLKernelLibraryEx.h.
References context().
Referenced by onert::backend::acl_cl::Config::initialize().
bool CLKernelLibraryEx::int64_base_atomics_supported | ( | ) | const |
Returns true if int64_base_atomics extension is supported by the CL device.
Definition at line 269 of file CLKernelLibrary.cpp.
size_t CLKernelLibraryEx::max_local_workgroup_size | ( | const cl::Kernel & | kernel | ) | const |
Find the maximum number of local work items in a workgroup can be supported for the kernel.
[in] | kernel | kernel object |
Definition at line 350 of file CLKernelLibrary.cpp.
|
delete |
Prevent instances of this class from being copied.
|
inline |
Set the CL context used to create programs.
[in] | context | A CL context. |
Definition at line 132 of file CLKernelLibraryEx.h.
References context().
|
inline |
Set the CL device for which the programs are created.
[in] | device | A CL device. |
Definition at line 165 of file CLKernelLibraryEx.h.
|
inline |
Set the path that the kernels reside in.
[in] | kernel_path | Path of the directory from which kernel sources are loaded. |
Definition at line 110 of file CLKernelLibraryEx.h.