aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h
diff options
context:
space:
mode:
authorViet-Hoa Do <viet-hoa.do@arm.com>2022-12-16 14:45:57 +0000
committerViet-Hoa Do <viet-hoa.do@arm.com>2022-12-30 13:59:23 +0000
commit3558c5840e7c973e2b1a86ae3a9335b44cad59d4 (patch)
treeb5f14b344ff8bc03e5143a54a5f3480263db543e /src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h
parent9d3bd41030366326e9c8afe5db3a5812a76b135b (diff)
downloadComputeLibrary-3558c5840e7c973e2b1a86ae3a9335b44cad59d4.tar.gz
Add temporary tile support for dynamic fusion
* Multiple intermediate tensors can share the same tile. - A simple operator can reuse the input tensor for the result if the input tensor has the same shape, data type and it is only consumed by that operator. - The special case is a simple operator and an output operator consume the same tensor. However as the output operator doesn't change the content of the input tensor, it doesn't count as "consuming" the input tensor. * These temporary tiles are declared automatically by the template writer. Individual operator doesn't need to generate output tile declaration. * Cast is now simple operator. Resolves: COMPMID-5778 Signed-off-by: Viet-Hoa Do <viet-hoa.do@arm.com> Change-Id: I232647ac976645e2d266a62e055b9eb48c356a8e Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8877 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h')
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h b/src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h
index 386aefdc05..c939aec369 100644
--- a/src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h
+++ b/src/dynamic_fusion/sketch/gpu/GpuKernelComponentGroup.h
@@ -30,6 +30,7 @@
#include <cstdlib>
#include <vector>
#include <set>
+#include <map>
namespace arm_compute
{
@@ -109,6 +110,22 @@ public:
* @return false Otherwise
*/
bool is_intermediate_tensor(const ITensorInfo *tensor) const;
+ /** Check if an @ref ITensorInfo is an input tensor of the group.
+ *
+ * @param[in] tensor @ref ITensorInfo to be looked up.
+ *
+ * @return true if @p tensor is an input tensor of the group, otherwise false.
+ */
+ bool is_input_tensor(const ITensorInfo *tensor) const;
+ /** Get the list of temporary tiles that need to be declared */
+ std::vector<const ITensorInfo *> get_tiles() const;
+ /** Get the shared tile that can be used to store temporary data of the specified tensor.
+ *
+ * @param[in] tensor @ref ITensorInfo to be looked up.
+ *
+ * @return @ref ITensorInfo that is used to store temporary data of @p tensor.
+ **/
+ const ITensorInfo *get_tile_for_tensor(const ITensorInfo *tensor) const;
/** Get the number of components within the group */
size_t size() const;
/** Check if the component group is empty */
@@ -126,9 +143,13 @@ private:
std::vector<ComponentPtr> _components{};
bool _finalized{ false };
+
std::vector<const ITensorInfo *> _argument_tensors{};
+ std::set<const ITensorInfo *> _input_tensors{};
std::set<const ITensorInfo *> _interm_tensors{};
const ITensorInfo *_any_output_tensor{ nullptr };
+ std::vector<const ITensorInfo *> _tiles{};
+ std::map<const ITensorInfo *, const ITensorInfo *> _tile_map{};
};
} // namespace dynamic_fusion
} // namespace experimental