Compute Library
 22.08
ClStoreIndirectWidthSelectKernelComponent Class Reference

#include <ClStoreKernelComponents.h>

Collaboration diagram for ClStoreIndirectWidthSelectKernelComponent:
[legend]

Public Member Functions

 ClStoreIndirectWidthSelectKernelComponent (ClKernelBlueprint *blueprint, const Link &src, const Link &dst)
 
ComponentType get_component_type () const override
 
std::string get_component_code () const override
 
CLBuildOptions generate_build_options () const override
 
virtual TagLUT get_tag_lut (const SharedVarTable &vtable) const override
 Get the tag look-up table used to instantiate the component code. More...
 
void allocate_shared_vars (SharedVarTable &vtable) const override
 Allocate all shared variables used by the component in the vtable. More...
 
virtual std::vector< Linkget_links () const override
 
virtual std::string name () const override
 
- Public Member Functions inherited from IClKernelComponent
 IClKernelComponent (ClKernelBlueprint *blueprint)
 
 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE (IClKernelComponent)
 
virtual ~IClKernelComponent ()=default
 
ComponentID id () const
 
void set_id (ComponentID id)
 
virtual std::set< std::string > get_headers_list () const
 
virtual std::string get_additional_macros () const
 
virtual Window get_window () const
 
virtual std::string get_dst_addr_calculation () const
 
virtual std::string generate_config_id () const
 Generate config id of the component. More...
 

Additional Inherited Members

- Public Types inherited from IClKernelComponent
using Link = SharedVarLink
 
using Tag = std::string
 
using TagLUT = std::unordered_map< Tag, TagVal >
 
- Static Public Member Functions inherited from IClKernelComponent
static std::string replace_tags (const std::string &code_template, const TagLUT &tags)
 

Detailed Description

Definition at line 65 of file ClStoreKernelComponents.h.

Constructor & Destructor Documentation

◆ ClStoreIndirectWidthSelectKernelComponent()

Member Function Documentation

◆ allocate_shared_vars()

void allocate_shared_vars ( SharedVarTable vtable) const
overridevirtual

Allocate all shared variables used by the component in the vtable.

Parameters
vtable

Implements IClKernelComponent.

Definition at line 145 of file ClStoreKernelComponents.cpp.

References SharedVarTable::add(), SharedVarLink::arg_id, and arm_compute::experimental::dynamic_fusion::Tensor_4D_t_Buffer.

146 {
147  vtable.add(_src, _blueprint->impl().group(_src.arg_id), ClKernelArgDescriptor(_src.arg_id, ClKernelTensorArgType::Tensor_4D_t_Buffer), "src");
148  vtable.add(_dst, _blueprint->impl().group(_dst.arg_id), ClKernelArgDescriptor(_dst.arg_id, ClKernelTensorArgType::Tensor_4D_t_Buffer), "dst");
149 }

◆ generate_build_options()

CLBuildOptions generate_build_options ( ) const
overridevirtual

Reimplemented from IClKernelComponent.

Definition at line 138 of file ClStoreKernelComponents.cpp.

139 {
140  CLBuildOptions build_opts{};
141 
142  return build_opts;
143 }

◆ get_component_code()

std::string get_component_code ( ) const
overridevirtual

Reimplemented from IClKernelComponent.

Definition at line 106 of file ClStoreKernelComponents.cpp.

107 {
108  return R"_(
109  //------------------ START KERNEL {{meta_kernel_id}} STORE ---------------------
110  {
111  // This also follows NHWC layout
112  // cout maps to global_id(0) maps to Channel
113  // mout maps to global_id(1) maps to Height and Weight (Collapsed Window)
114  // bout maps to global_id(3) maps to N / Batch
115  #define _IDST_WIDTH {{dst}}_w
116  #define _IDST_HEIGHT {{dst}}_h
117  TILE(uint, M0, 1, dst_indirect_y);
118 
119  // Calculate the destination indirect Y
120  LOOP_UNROLLING(int, i, 0, 1, M0,
121  {
122  dst_indirect_y[i].v = (uint)min(mout + i, (int)(_IDST_WIDTH * _IDST_HEIGHT) - 1);
123  dst_indirect_y[i].v += bout * (int)(_IDST_WIDTH * _IDST_HEIGHT);
124  })
125 
126  bool x_cond = PARTIAL_N0 != 0 && get_global_id(0) == 0;
127 
128  T_STORE_INDIRECT_WIDTH_SELECT({{DST_DATA_TYPE}}, M0, N0, PARTIAL_N0, {{DST_TENSOR_TYPE}}, {{dst}}, cout, {{dst}}_stride_y, x_cond, {{src}}, dst_indirect_y);
129 
130  #undef _IDST_WIDTH
131  #undef _IDST_HEIGHT
132  //------------------ END KERNEL {{meta_kernel_id}} STORE ---------------------
133  }
134 
135 )_";
136 }

◆ get_component_type()

ComponentType get_component_type ( ) const
overridevirtual

◆ get_links()

virtual std::vector<Link> get_links ( ) const
inlineoverridevirtual

Implements IClKernelComponent.

Definition at line 78 of file ClStoreKernelComponents.h.

79  {
80  return { _src, _dst };
81  }

◆ get_tag_lut()

ClStoreIndirectWidthSelectKernelComponent::TagLUT get_tag_lut ( const SharedVarTable vtable) const
overridevirtual

Get the tag look-up table used to instantiate the component code.

Parameters
vtable
Returns
TagLUT

Implements IClKernelComponent.

Definition at line 151 of file ClStoreKernelComponents.cpp.

References SharedVarTable::get(), and IClKernelComponent::id().

152 {
153  TagLUT lut{};
154 
155  // Arguments and global shared variables
156  lut["src"] = vtable.get(_src);
157  lut["dst"] = vtable.get(_dst);
158 
159  // Local build options
160  lut["meta_kernel_id"] = id();
161  lut["DST_TENSOR_TYPE"] = "BUFFER";
162  const auto dst_info = _blueprint->impl().get_kernel_argument_info(_blueprint->impl().get_dst_id());
163  lut["DST_DATA_TYPE"] = dst_info->data_type();
164 
165  return lut;
166 }

◆ name()

virtual std::string name ( ) const
inlineoverridevirtual

Implements IClKernelComponent.

Definition at line 83 of file ClStoreKernelComponents.h.

84  {
85  return "";
86  }

The documentation for this class was generated from the following files: