Class OpenCLRuntimeWrapper
Defined in File opencl_runtime_wrapper.h
Class Documentation
-
class OpenCLRuntimeWrapper
Public Functions
-
inline Status LoadSource(const std::string &program_name, const std::string &source)
Load the OpenCl source code and bind the program name.
- Parameters
program_name – [in] Define OpenCl source program name.
source – [in] Define OpenCl source.
- Returns
Status as a status identification of loading code.
-
inline Status BuildKernel(cl::Kernel *kernel, const std::string &program_name, const std::string &kernel_name, const std::vector<std::string> &build_options_ext = {})
Building OpenCL code.
- Parameters
kernel – [in] Used to return the compiled kernel
program_name – [in] Define OpenCl source program name.
kernel_name – [in] Define OpenCl source kernel name.
build_options_ext – [in] Define OpenCl kernel build options.
- Returns
Status as a status identification of build Kernel
-
Status SetKernelArg(const cl::Kernel &kernel, uint32_t index, void *const value)
Set kernel argument.
- Parameters
kernel – [in] Define OpenCl kernel.
index – [in] Define OpenCl kernel argument index.
value – [in] Define OpenCl kernel argument value pointer.
mem_type – [in] Define OpenCl kernel argument value memory type.
- Returns
Status as a status identification of set kernel argument
-
template<typename T>
inline std::enable_if<!std::is_pointer<T>::value, Status>::type SetKernelArg(const cl::Kernel &kernel, uint32_t index, const T value) Set kernel argument.
- Parameters
kernel – [in] Define OpenCl kernel.
index – [in] Define OpenCl kernel argument index.
value – [in] Define OpenCl kernel argument value.
mem_type – [in] Define OpenCl kernel argument value memory type.
- Returns
Status as a status identification of set kernel argument
-
Status RunKernel(const cl::Kernel &kernel, const cl::NDRange &global, const cl::NDRange &local, cl::CommandQueue *command_queue = nullptr, cl::Event *event = nullptr)
Run OpenCl kernel.
- Parameters
kernel – [in] Define OpenCl kernel.
global – [in] Define the number of work items
local – [in] Define the number of work_items in a work_group
command_queue – [in] Define the command queue
event – [in] Define event of kernel run
- Returns
Status as a status identification of run OpenCl kernel
-
inline Status LoadSource(const std::string &program_name, const std::string &source)