23.11
|
Go to the documentation of this file.
55 constant_border_value.
get(value);
56 ICLKernel::add_argument<T>(idx,
static_cast<T
>(value));
112 const unsigned int valid_width =
tensor->valid_region().shape[0];
113 const unsigned int valid_height =
tensor->valid_region().shape[1];
114 const cl_int2 valid_region_coords = {{
115 static_cast<cl_int
>(
tensor->valid_region().anchor[0]),
116 static_cast<cl_int
>(
tensor->valid_region().anchor[1]),
122 ICLKernel::add_argument<cl_uint>(idx, valid_width);
123 ICLKernel::add_argument<cl_uint>(idx, valid_height);
124 ICLKernel::add_argument<cl_int2>(idx, valid_region_coords);
131 set_constant_border<uint8_t>(idx, constant_border_value);
135 set_constant_border<int8_t>(idx, constant_border_value);
138 set_constant_border<uint16_t>(idx, constant_border_value);
141 set_constant_border<int16_t>(idx, constant_border_value);
144 set_constant_border<uint32_t>(idx, constant_border_value);
147 set_constant_border<int32_t>(idx, constant_border_value);
150 static_assert(
sizeof(
float) == 4,
"Float must be 32 bit");
151 set_constant_border<float>(idx, constant_border_value);
154 static_assert(
sizeof(cl_half) ==
sizeof(
half),
"Half must be same size as cl_half");
155 static_assert(
sizeof(cl_half) == 2,
"Half must be 16 bit");
156 set_constant_border<half>(idx, constant_border_value);
168 ICLKernel::configure_internal(win);
186 if (_kernel() ==
nullptr)
202 unsigned int idx = 0;
211 if (_kernel() ==
nullptr)
224 unsigned int idx = 0;
std::string to_string(T &&value)
Convert integer and float values to string.
unsigned int right
right of the border
@ CONSTANT
Pixels outside the image are assumed to have a constant value.
void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.
Class describing the value of a pixel for any image format.
const StringSet & options() const
Gets the current options list set.
bool is_parallelisable() const override
Indicates whether or not the kernel is parallelisable.
Container for 2D border size.
@ UNDEFINED
Borders are left undefined.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
void get(uint8_t &v) const
Interpret the pixel value as a U8.
@ U16
unsigned 16-bit number
std::string lower_string(const std::string &val)
Lower a given string.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed=nullptr) const
Collapse the dimensions between first and last if possible.
Interface for OpenCL tensor.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
unsigned int top
top of the border
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
const std::string & string_from_border_mode(BorderMode border_mode)
Translates a given border mode policy to a string.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
virtual BorderSize border_size() const
The size of the border for that kernel.
constexpr bool empty() const
Check if the entire border is zero.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context.
half_float::half half
16-bit floating point type
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
unsigned int bottom
bottom of the border
CLFillBorderKernel()
Default constructor.
void limit(const BorderSize &limit)
Limit this border size.
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
@ U32
unsigned 32-bit number
void add_option(std::string option)
Adds option to the existing build option list.
void set_constant_border(unsigned int idx, const PixelValue &constant_border_value)
Function to set the constant value on fill border kernel depending on type.
@ U8
unsigned 8-bit number
@ S16
signed 16-bit number
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
Creates an opencl kernel using a compile context.
@ QASYMM8_SIGNED
quantized, asymmetric fixed-point 8-bit number signed
bool slide_window_slice_3D(Window &slice) const
Slide the passed 3D window slice.
Wrapper to configure the Khronos OpenCL C++ header.
CLTensor * tensor
Pointer to the auxiliary tensor.
Describe one of the image's dimensions with a start, end and step.
Common interface for all the OpenCL kernels.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
Window first_slice_window_3D() const
First 3D slice of the window.
const Window & window() const
The maximum window the kernel can be executed on.
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
void add_3D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 3D tensor's parameters to the object's kernel's arguments starting from the index idx.
Describe a multidimensional execution window.
@ ELEMENTWISE
Elementwise CL kernel type.
constexpr static unsigned int num_arguments_per_3D_tensor()
Returns the number of arguments enqueued per 3D tensor object.
Copyright (c) 2017-2023 Arm Limited.
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue.
@ F16
16-bit floating-point number
unsigned int left
left of the border
bool has_padding_changed(const std::unordered_map< const ITensorInfo *, PaddingSize > &padding_map)
Check if the previously stored padding info has changed after configuring a kernel.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
@ S32
signed 32-bit number
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
BorderMode
Methods available to handle borders.
Store the tensor's metadata.
@ F32
32-bit floating-point number
#define ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(f, w)
void configure(const CLCompileContext &compile_context, ICLTensor *tensor, BorderSize border_size, BorderMode border_mode, const PixelValue &constant_border_value=PixelValue())
Initialise the kernel's input, output and border mode.
DataType
Available data types.
std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info(std::initializer_list< const ITensorInfo * > infos)
Stores padding information before configuring a kernel.
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
void enqueue(cl::CommandQueue &queue, ICLKernel &kernel, const Window &window, const cl::NDRange &lws_hint=CLKernelLibrary::get().default_ndrange(), bool use_dummy_work_items=false)
Add the kernel to the command queue with the given window.