24.02.1
|
Go to the documentation of this file.
36 namespace experimental
38 namespace dynamic_fusion
61 //------------------ START KERNEL {{meta_kernel_id}} ---------------------
67 // OUT(dst, accum) {{dst}}
69 TILE({{DATA_TYPE}}, M0, N0, {{src}});
70 TILE(uint, M0, 1, g_dst_indirect_y);
72 {{src}}_offset_first_element_in_bytes += g_ind_2 * {{src}}_stride_z;
74 T_LOAD({{DATA_TYPE}}, M0, N0, {{TENSOR_TYPE}}, {{src}}, g_ind_0, g_ind_1, 1, {{src}}_stride_y, {{src}});
76 T_ACTIVATION({{DATA_TYPE}}, M0, N0, {{ACT}}, {{A_VAL}}, {{B_VAL}}, {{src}}, {{dst}});
79 LOOP_UNROLLING(int, i, 0, 1, M0,
81 g_dst_indirect_y[i].v = (uint)min((int)(g_ind_1 + i), (int)({{arg_dst}}_w) - 1);
82 g_dst_indirect_y[i].v += (int)(g_ind_2 % {{arg_dst}}_h) * (int)({{arg_dst}}_w);
83 g_dst_indirect_y[i].v += (int)(g_ind_2 / {{arg_dst}}_h) * (int)({{arg_dst}}_w * {{arg_dst}}_h);
90 // IN/OUT(src, accum) {{src}}
93 T_ACTIVATION({{DATA_TYPE}}, M0, N0, {{ACT}}, {{A_VAL}}, {{B_VAL}}, {{src}}, {{dst}});
98 //------------------ END KERNEL {{meta_kernel_id}} ---------------------
125 lut[
"meta_kernel_id"] =
id();
127 lut[
"TENSOR_TYPE"] =
"BUFFER";
142 const unsigned int n0 = root_window.
x().
step();
143 const unsigned int m0 = root_window.y().step();
144 const unsigned int partial_store_n0 = _dst->
dimension(0) % n0;
156 std::string config_id{};
157 config_id +=
"activation_";
168 return std::set<std::string>{
"helpers.h",
"tile_helpers.h",
"activation_float_helpers.h"};
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.
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)
std::unordered_map< Tag, TagVal > TagLUT
Tag lookup table.
constexpr int step() const
Return the step of the dimension.
std::string lower_string(const std::string &val)
Lower a given string.
ComponentPtr get_root_component() const
Get the root (first) component of this group.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
ActivationFunction activation() const
Get the type of activation function.
const ITensorInfo * get_any_dst_tensor() const
Get one of the destination tensors of this group.
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.
Activation Layer Information class.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Window get_window() const override
Generate the execution window for the component.
void add_option(std::string option)
Adds option to the existing build option list.
std::string get_component_code(const ComponentGroup &comp_group) const override
Generate kernel component code template.
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.
std::string float_to_string_with_full_precision(float val)
Create a string with the float in full precision.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
ComponentId id() const
Get component id.
ClTemplateActivation(ComponentId id, const ArgumentPack< ITensorInfo > &tensors, const Attributes &attributes)
Constructor.
Contain information required to set up a kernel argument at run time.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
TensorVariable get_variable(const ITensorInfo *tensor) const
Get the TensorVariable associated with tensor.
std::set< std::string > get_headers_list() const override
Generate the header list used in the component.
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::string get_config_id() const override
Generate the component config id string used for tuning.
float a() const
Get the alpha value.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
CLBuildOptions get_build_options(const ComponentGroup &comp_group) const override
Generate the build options used in the component.
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:
const std::string & string_from_activation_func(const ActivationFunction &act)
Translates a given activation function to a string.
std::string get_name() const override
Generate kernel component name.
virtual Window get_window() const
Generate the execution window for the component.
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.
float b() const
Get the beta value.
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.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
ComponentId id() const
Get component id.
void declare_variables(GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override
Declare all variables used by the component in the vtable.