Compute Library
 22.08
ClStoreBlockBoundaryAwareKernelComponent Class Reference

#include <ClStoreKernelComponents.h>

Collaboration diagram for ClStoreBlockBoundaryAwareKernelComponent:
[legend]

Public Member Functions

 ClStoreBlockBoundaryAwareKernelComponent (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
 
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 37 of file ClStoreKernelComponents.h.

Constructor & Destructor Documentation

◆ ClStoreBlockBoundaryAwareKernelComponent()

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 86 of file ClStoreKernelComponents.cpp.

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

Referenced by ClStoreBlockBoundaryAwareKernelComponent::ClStoreBlockBoundaryAwareKernelComponent(), and ClStoreIndirectWidthSelectKernelComponent::ClStoreIndirectWidthSelectKernelComponent().

87 {
88  vtable.add(_src, _blueprint->impl().group(_src.arg_id), ClKernelArgDescriptor(_src.arg_id, ClKernelTensorArgType::Image_3D), "src");
89  vtable.add(_dst, _blueprint->impl().group(_dst.arg_id), ClKernelArgDescriptor(_dst.arg_id, ClKernelTensorArgType::Image_3D), "dst");
90 }

◆ generate_build_options()

CLBuildOptions generate_build_options ( ) const
overridevirtual

Reimplemented from IClKernelComponent.

Definition at line 65 of file ClStoreKernelComponents.cpp.

References arm_compute::get_cl_type_from_data_type(), arm_compute::test::validation::t_dst_info, and arm_compute::support::cpp11::to_string().

Referenced by ClStoreBlockBoundaryAwareKernelComponent::ClStoreBlockBoundaryAwareKernelComponent(), and ClStoreIndirectWidthSelectKernelComponent::ClStoreIndirectWidthSelectKernelComponent().

66 {
67  auto t_dst_info = _blueprint->impl().get_kernel_argument_info(_blueprint->impl().get_dst_id());
68  // auto tile_info = _blueprint->impl().get_tile_info();
69 
70  CLBuildOptions build_opts{};
71 
72  const auto n0 = _blueprint->impl().get_execution_window().x().step();
73  const auto m0 = _blueprint->impl().get_execution_window().y().step();
74  const auto partial_m0 = t_dst_info->dimension(0) % m0;
75  const auto partial_n0 = t_dst_info->dimension(1) % n0;
76 
77  build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(t_dst_info->data_type()));
78  build_opts.add_option("-DM0=" + support::cpp11::to_string(m0));
79  build_opts.add_option("-DN0=" + support::cpp11::to_string(n0));
80  build_opts.add_option("-DPARTIAL_STORE_M0=" + support::cpp11::to_string(partial_m0));
81  build_opts.add_option("-DPARTIAL_STORE_N0=" + support::cpp11::to_string(partial_n0));
82 
83  return build_opts;
84 }
std::string to_string(T &&value)
Convert integer and float values to string.
std::string get_cl_type_from_data_type(const DataType &dt)
Translates a tensor data type to the appropriate OpenCL type.
Definition: CLHelpers.cpp:39

◆ get_component_code()

std::string get_component_code ( ) const
overridevirtual

Reimplemented from IClKernelComponent.

Definition at line 39 of file ClStoreKernelComponents.cpp.

Referenced by ClStoreBlockBoundaryAwareKernelComponent::ClStoreBlockBoundaryAwareKernelComponent(), and ClStoreIndirectWidthSelectKernelComponent::ClStoreIndirectWidthSelectKernelComponent().

40 {
41  return R"_(
42  //------------------ START KERNEL {{meta_kernel_id}} STORE ---------------------
43 
44  __global uchar *dst_addr = {{dst}}_ptr + {{dst}}_offset_first_element_in_bytes + (g_x * (uint)N0 * sizeof(DATA_TYPE)) + (COMPUTE_M0_START_ROW(g_y, M0, PARTIAL_STORE_M0) * {{dst}}_stride_y);
45 
46 #if defined(REINTERPRET_OUTPUT_AS_3D)
47  // Add offset for batched GEMM. The batches will be in the fourth dimension and for this reason we
48  // multiply dst_stride_z by DEPTH_GEMM3D
49  dst_addr += g_z * {{dst}}_stride_z * DEPTH_GEMM3D;
50 
51 #else // defined(REINTERPRET_OUTPUT_AS_3D)
52 
53  // Add offset for batched GEMM
54  dst_addr += g_z * {{dst}}_stride_z;
55 
56 #endif // defined(REINTERPRET_OUTPUT_AS_3D)
57 
58  STORE_BLOCK_BOUNDARY_AWARE(M0, N0, DATA_TYPE, {{src}}, dst_addr, {{dst}}_stride_y, g_zout, PARTIAL_STORE_M0, PARTIAL_STORE_N0, g_cond_y, g_cond_x);
59 
60  //------------------ END KERNEL {{meta_kernel_id}} STORE ---------------------
61 
62 )_";
63 }

◆ get_component_type()

◆ get_links()

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

Implements IClKernelComponent.

Definition at line 50 of file ClStoreKernelComponents.h.

51  {
52  return { _src, _dst };
53  }

◆ get_tag_lut()

ClStoreBlockBoundaryAwareKernelComponent::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 92 of file ClStoreKernelComponents.cpp.

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

Referenced by ClStoreBlockBoundaryAwareKernelComponent::ClStoreBlockBoundaryAwareKernelComponent(), and ClStoreIndirectWidthSelectKernelComponent::ClStoreIndirectWidthSelectKernelComponent().

93 {
94  return {
95  { "meta_kernel_id", id() },
96  { "src", vtable.get(_src) },
97  { "dst", vtable.get(_dst) },
98  };
99 }

◆ name()

virtual std::string name ( ) const
inlineoverridevirtual

Implements IClKernelComponent.

Definition at line 55 of file ClStoreKernelComponents.h.

56  {
57  return "";
58  }

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