blob: 3f97a82204d504aaa6e3c46ca8c8753a6de6b500 [file] [log] [blame]
SiCong Lif44bbc52022-08-29 18:25:51 +01001/*
2 * Copyright (c) 2022 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef SRC_DYNAMIC_FUSION_SKETCH_GPU_TEMPLATE_WRITER_CL_CLTEMPLATESTORE
25#define SRC_DYNAMIC_FUSION_SKETCH_GPU_TEMPLATE_WRITER_CL_CLTEMPLATESTORE
26
27#include "arm_compute/core/experimental/Types.h"
28#include "src/dynamic_fusion/sketch/gpu/template_writer/GpuKernelVariableTable.h"
29#include "src/dynamic_fusion/sketch/gpu/template_writer/IGpuTemplateComponentWriter.h"
30
31namespace arm_compute
32{
33namespace experimental
34{
35namespace dynamic_fusion
36{
37class ClTemplateStore final : public IGpuTemplateComponentWriter
38{
39public:
40 /** Constructor
41 *
42 * @param[in] id Component id
43 * @param[in] tensors Tensor arguments to the components
44 */
45 ClTemplateStore(ComponentId id, const ArgumentPack<ITensorInfo> &tensors);
46 /** Prevent instances of this class from being copy constructed */
47 ClTemplateStore(const ClTemplateStore &store) = delete;
48 /** Prevent instances of this class from being copied */
49 ClTemplateStore &operator=(const ClTemplateStore &store) = delete;
50 /** Allow instances of this class to be move constructed */
51 ClTemplateStore(ClTemplateStore &&store) = default;
52 /** Allow instances of this class to be moved */
53 ClTemplateStore &operator=(ClTemplateStore &&store) = default;
54 /** Generate kernel component name */
55 std::string get_name() const override;
56 /** Generate kernel component code template
57 *
58 * @param[in] comp_group Component group of which the component is a part of
59 *
60 * @return std::string Component code
61 */
62 std::string get_component_code(const ComponentGroup &comp_group) const override;
63 /** Declare all variables used by the component in the @p vtable
64 *
65 * @param[out] vtable Variable table
66 * @param[in] comp_group Component group of which the component is a part of
67 */
68 void declare_variables(GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override;
69 /** Generate the tag look-up table used to instantiate the component code.
70 *
71 * @param[in] vtable Variable table
72 * @param[in] comp_group Component group of which the component is a part of
73 *
74 * @return TagLUT Tag lookup table
75 */
76 TagLUT get_tag_lut(const GpuKernelVariableTable &vtable, const ComponentGroup &comp_group) const override;
77
78private:
79 const ITensorInfo *_src;
80 const ITensorInfo *_dst;
81};
82} // namespace dynamic_fusion
83} // namespace experimental
84} // namespace arm_compute
85#endif /* SRC_DYNAMIC_FUSION_SKETCH_GPU_TEMPLATE_WRITER_CL_CLTEMPLATESTORE */