24.02.1
|
Go to the documentation of this file.
35 namespace experimental
37 namespace dynamic_fusion
54 return "logits_1d_norm";
61 std::string code = R
"_(
62 //------------------ START KERNEL {{meta_kernel_id}} ---------------------
64 const int x_offs = g_ind_0 * sizeof({{DATA_TYPE}});
65 __global uchar *src_addr = {{src}}_ptr + {{src}}_offset_first_element_in_bytes + x_offs + g_ind_1 * {{src}}_stride_y + g_ind_2 * {{src}}_stride_z;
66 __global uchar *dst_addr = {{dst}}_ptr + {{dst}}_offset_first_element_in_bytes + x_offs + g_ind_1 * {{dst}}_stride_y + g_ind_2 * {{dst}}_stride_z;
67 Image sum = CONVERT_TENSOR3D_TO_IMAGE_STRUCT_NO_STEP({{sum}});
71 {{DATA_TYPE}} sum_val = *((__global {{DATA_TYPE}} *)offset(&sum, 0, g_ind_1));
72 VEC_DATA_TYPE({{DATA_TYPE}}, N0)
73 data0 = VLOAD(N0)(0, (__global {{DATA_TYPE}} *)src_addr);
79 sum_val = log(sum_val);
91 STORE_VECTOR_SELECT(data, {{DATA_TYPE}}, dst_addr, N0, PARTIAL_N0, PARTIAL_N0 != 0 && g_ind_0 == 0);
93 //------------------ END KERNEL {{meta_kernel_id}} ---------------------
120 lut[
"meta_kernel_id"] =
id();
135 const unsigned int n0 = root_window.
x().
step();
156 return std::set<std::string>{
"helpers.h",
"tile_helpers.h"};
162 constexpr
unsigned int serial_vector_size = 16;
Class to describe a number of elements in each dimension.
std::string to_string(T &&value)
Convert integer and float values to string.
virtual const IGpuTemplateComponentWriter * template_writer() const
Get writer for the component.
std::string get_component_code(const ComponentGroup &comp_group) const override
Generate kernel component code template.
constexpr size_t vector_size
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
Window get_window() const override
Generate the execution window for the component.
std::unordered_map< Tag, TagVal > TagLUT
Tag lookup table.
constexpr int step() const
Return the step of the dimension.
ComponentPtr get_root_component() const
Get the root (first) component of this group.
Attributes are backend-agnostic parameters (in addition to the input/output tensors) of an operator.
std::string get_name() const override
Generate kernel component name.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
An interface used by ClTemplateWriter to write source code for a kernel component.
This is a generic class that packs the arguments of an operator.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Window collapse(const Window &full_window, size_t first, size_t last=Coordinates::num_max_dimensions) const
Collapse the dimensions between first and last.
ArgumentPack< ITensorInfo > tensors() const
Get tensor arguments.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
size_t total_size() const
Collapses all dimensions to a single linear total size.
CLBuildOptions get_build_options(const ComponentGroup &comp_group) const override
Generate the build options used in the component.
TagLUT get_tag_lut(const GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override
Generate the tag look-up table used to instantiate the component code.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
ComponentId id() const
Get component id.
Contain information required to set up a kernel argument at run time.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
SoftmaxAttributes & is_log_softmax(bool is_log)
Set is_log.
TensorVariable get_variable(const ITensorInfo *tensor) const
Get the TensorVariable associated with tensor.
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
int32_t ComponentId
Uniquely identifies a kernel component within a workload.
std::set< std::string > get_headers_list() const override
Generate the header list used in the component.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
unsigned int adjust_vec_size(unsigned int vec_size, size_t dim0)
Returns the adjusted vector size in case it is less than the input's first dimension,...
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
A group of gpu kernel components to be fused together PRECONDITIONS:
virtual Window get_window() const
Generate the execution window for the component.
ClTemplateLogits1DNorm(ComponentId id, const ArgumentPack< ITensorInfo > &tensors, const Attributes &attributes)
Constructor.
std::string get_config_id() const override
Generate the component config id string used for tuning.
A table of all the variables used in the kernel.
void declare_variable(const GpuKernelComponentGroup &comp_group, const ITensorInfo *tensor, GpuKernelArgumentInfo argument_info, const std::string &alias="unnamed")
Declare a TensorVariable for a corresponding tensor info.
void declare_variables(GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override
Declare all variables used by the component in the vtable.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
DataType
Available data types.