34 CLKernelLibrary::CLKernelLibrary()
42 return _kernel_library;
47 const std::string program_name = klib.
program_name(kernel_name);
48 auto program = klib.
program(program_name);
50 return _compile_context.
create_kernel(kernel_name, program_name, program.program, kernel_path, build_options_set, program.is_binary);
67 return _compile_context.
context();
112 return std::make_pair(std::move(program_info.program), program_info.is_binary);
132 return _compile_context;
void set_kernel_path(const std::string &kernel_path)
Sets the path that the kernels reside in.
void set_device(cl::Device device)
Sets the CL device for which the programs are created.
const cl::Device & get_device() const
Gets the CL device for which the programs are created.
cl::Context & context()
Accessor for the associated CL context.
bool is_wbsm_supported() const
ClKernelLibrary contains all the OpenCL kernels that are used throughout the library.
void add_built_program(const std::string &built_program_name, const cl::Program &program)
Add a new built program to the cache.
std::string get_device_version()
Return the device version.
std::pair< std::string, bool > get_program(const std::string &program_name) const
Gets the source of the selected program.
ClProgramInfo program(const std::string &program_name) const
Gets the source of the selected program.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
std::string program_name(const std::string &kernel_name) const
Returns the program name given a kernel name.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
CLCompileContext & get_compile_context()
Gets the compile context used.
void set_context(cl::Context context)
Sets the CL context used to create programs.
std::string get_device_version() const
Return the device version.
Copyright (c) 2017-2021 Arm Limited.
cl_uint get_num_compute_units()
Return the maximum number of compute units in the device.
const std::string & kernel_path() const
Gets the path that the kernels reside in.
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.
static ClKernelLibrary & get()
Access the KernelLibrary singleton.
void clear_programs_cache()
Clear the library's cache of binary programs.
void set_device(cl::Device device)
Sets the CL device for which the programs are created.
cl_uint get_num_compute_units() const
Return the maximum number of compute units in the device.
Kernel create_kernel(const std::string &kernel_name, const std::set< std::string > &build_options_set={}) const
Creates a kernel from the kernel library.
cl::NDRange default_ndrange() const
Return the default NDRange for the device.
void init(std::string kernel_path, cl::Context context, cl::Device device)
Initialises the kernel library.
Kernel create_kernel(const std::string &kernel_name, const std::string &program_name, const std::string &program_source, const std::string &kernel_path, const StringSet &build_options_set, bool is_binary) const
Creates an OpenCL kernel.
std::string get_program_name(const std::string &kernel_name) const
Returns the program name given a kernel name.
void clear_programs_cache()
Clear the library's cache of binary programs.
bool int64_base_atomics_supported() const
Returns true if int64_base_atomics extension is supported by the CL device.
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.
const std::map< std::string, cl::Program > & get_built_programs() const
Access the cache of built OpenCL programs.
bool fp16_supported() const
Returns true if FP16 is supported by the CL device.
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...
void set_kernel_path(std::string kernel_path)
Sets the path that the kernels reside in.
std::string get_kernel_path()
Gets the path that the kernels reside in.
void add_built_program(const std::string &built_program_name, const cl::Program &program) const
Add a new built program to the cache.
void set_context(cl::Context context)
Sets the CL context used to create programs.
const std::map< std::string, cl::Program > & get_built_programs() const
Access the cache of built OpenCL programs.
const cl::Device & get_device()
Gets the CL device for which the programs are created.
bool opencl_is_available()
Check if OpenCL is available.
cl::Context & context()
Accessor for the associated CL context.