Class OpenCLRuntimeWrapper

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.

参数
  • program_name[in] Define OpenCl source program name.

  • source[in] Define OpenCl source.

返回

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.

参数
  • 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.

返回

Status as a status identification of build Kernel

Status SetKernelArg(const cl::Kernel &kernel, uint32_t index, void *const value)

Set kernel argument.

参数
  • 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.

返回

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.

参数
  • 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.

返回

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.

参数
  • 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

返回

Status as a status identification of run OpenCl kernel

Status SyncCommandQueue()

Synchronization command queue.

返回

Status as a status identification of synchronization command queue