24.02.1
|
Go to the documentation of this file.
34 namespace experimental
36 namespace dynamic_fusion
59 //------------------ START KERNEL {{meta_kernel_id}} ---------------------
62 // OUT(dst, accum) {{dst}}
64 TILE(uint, M0, 1, g_dst_indirect_y);
66 __global uchar * base_src_ptr = {{src}}_ptr + {{src}}_offset_first_element_in_bytes;
67 const int tile_vertical_idx = g_ind_1 * {{arg_dst}}_c + g_ind_2 * {{arg_dst}}_c * {{arg_dst}}_w;
68 LOOP_UNROLLING(int, _m0, 0, 1, M0,
70 const int row_idx = _m0 * {{arg_dst}}_c + tile_vertical_idx;
71 const int tile_horizontal_idx = g_ind_0 + row_idx;
72 LOOP_UNROLLING(int, _n0, 0, 1, N0,
74 {{src}}_ptr = base_src_ptr;
75 const int linear_idx = tile_horizontal_idx + _n0;
76 const int in_id_x = linear_idx % {{src}}_c;
77 const int in_id_y = (linear_idx / {{src}}_c) % {{src}}_w;
78 const int in_id_z = linear_idx / ({{src}}_c * {{src}}_w);
79 {{src}}_ptr += in_id_x * sizeof({{DATA_TYPE}}) + in_id_y * {{src}}_stride_y + in_id_z * {{src}}_stride_z;
80 {{dst}}[_m0].s[_n0] = *((__global {{DATA_TYPE}} *){{src}}_ptr);
84 LOOP_UNROLLING(int, i, 0, 1, M0,
86 g_dst_indirect_y[i].v = (uint)min((int)(g_ind_1 + i), (int)({{arg_dst}}_w) - 1);
87 g_dst_indirect_y[i].v += (int)(g_ind_2 % {{arg_dst}}_h) * (int)({{arg_dst}}_w);
88 g_dst_indirect_y[i].v += (int)(g_ind_2 / {{arg_dst}}_h) * (int)({{arg_dst}}_w * {{arg_dst}}_h);
91 //------------------ END KERNEL {{meta_kernel_id}} ---------------------
114 lut[
"meta_kernel_id"] =
id();
124 const unsigned int n0 = root_window.
x().
step();
125 const unsigned int m0 = root_window.y().step();
126 const unsigned int partial_store_n0 = _dst->
dimension(0) % n0;
136 std::string config_id{};
148 return std::set<std::string>{
"helpers.h",
"tile_helpers.h"};
Class to describe a number of elements in each dimension.
std::string get_component_code(const ComponentGroup &comp_group) const override
Generate kernel component code template.
std::string to_string(T &&value)
Convert integer and float values to string.
virtual const IGpuTemplateComponentWriter * template_writer() const
Get writer for the component.
constexpr unsigned int vector_size_byte_opencl
ClTemplateReshape(ComponentId id, const ArgumentPack< ITensorInfo > &tensors)
Constructor.
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)
static constexpr GpuKernelArgumentInfo::Type common_tensor_type
For now all kernel intermeditate/destination tensors are expected to be of type Tensor_4D_t_Buffer.
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.
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.
#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.
std::string get_name() const override
Generate kernel component name.
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.
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.
void declare_variables(GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override
Declare all variables used by the component in the vtable.
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.
Window get_window() const override
Generate the execution window for the component.
CLBuildOptions get_build_options(const ComponentGroup &comp_group) const override
Generate the build options used in 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.
std::set< std::string > get_headers_list() const override
Generate the header list used in the component.
constexpr const Dimension & x() const
Alias to access the first dimension of the window.
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.
std::string get_config_id() const override
Generate the component config id string used for tuning.