24.04
|
Go to the documentation of this file.
44 const cl::NDRange &global,
45 const cl::NDRange &local)
49 _kernel_cmds.push_back(KernelCommand{kernel,
offset, global, local, {}});
52 void CLCompatCommandBuffer::add_mutable_argument_generic(cl_uint arg_idx,
const void *value,
size_t size)
57 _kernel_cmds.back().mutable_args.push_back(cl_mutable_dispatch_arg_khr{arg_idx, size, value});
64 _kernel_cmds.shrink_to_fit();
66 for (
auto &cmd : _kernel_cmds)
68 cmd.mutable_args.shrink_to_fit();
71 state(State::Finalized);
85 for (
const auto &cmd : _kernel_cmds)
87 for (
const auto &arg : cmd.mutable_args)
89 const auto error =
clSetKernelArg(cmd.kernel, arg.arg_index, arg.arg_size, arg.arg_value);
96 cmd.offset.dimensions() != 0 ? cmd.offset.get() :
nullptr, cmd.global.get(),
97 cmd.local.dimensions() != 0 ? cmd.local.get() :
nullptr, 0,
nullptr,
nullptr);
105 return state() == State::Finalized;
void update() override
Update the command buffer with new kernel argument values.
virtual ~CLCompatCommandBuffer()
Destructor.
void add_kernel(cl_kernel kernel, const cl::NDRange &offset, const cl::NDRange &global, const cl::NDRange &local) override
Add a kernel enqueue command to the command queue.
cl_int clEnqueueNDRangeKernel(cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event)
void finalize() override
Finalize the command buffer.
CLCompatCommandBuffer(cl_command_queue queue)
Create a new command buffer targeting the specified command queue.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
bool is_finalized() const override
Check if the command buffer has been finalized.
void handle_cl_error(const std::string &function_name, cl_int error_code)
Check for CL error code and throw exception accordingly.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Copyright (c) 2017-2024 Arm Limited.
void enqueue() override
Enqueue the command buffer.
cl_int clSetKernelArg(cl_kernel kernel, cl_uint arg_index, size_t arg_size, const void *arg_value)