aboutsummaryrefslogtreecommitdiff
path: root/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
diff options
context:
space:
mode:
authorGunes Bayir <gunes.bayir@arm.com>2023-01-03 21:26:09 +0000
committerGunes Bayir <gunes.bayir@arm.com>2023-01-06 13:45:22 +0000
commit3a1e1256946028cb13f31521caec9f08235c7332 (patch)
treecc63b85bc30ecdc81d7218d7adf05d27a96e6411 /src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
parentb3077fbaee868579f9a41888fef1f71286d6757c (diff)
downloadComputeLibrary-3a1e1256946028cb13f31521caec9f08235c7332.tar.gz
Handle Intermediate tensors within the sketch
- Intermediate tensor info objects are not created by the user anymore. They're returned from create_op and reused. This will prevent allocation of the intermediate tensors in case of possible interface misuse. - Sketch object handles intermediate tensor info pointers inside its implementation class via a unique pointer vector - Conv2d operator is migrated into the new interface Resolves: COMPMID-5776 Change-Id: I9422e3681eef4f2d2922f6d0a5d7786380837c6d Signed-off-by: Gunes Bayir <gunes.bayir@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8906 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: SiCong Li <sicong.li@arm.com> Reviewed-by: Viet-Hoa Do <viet-hoa.do@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h')
-rw-r--r--src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
index 3997395c98..08796b607b 100644
--- a/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
+++ b/src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -29,6 +29,9 @@
#include "src/dynamic_fusion/sketch/gpu/GpuKernelComponentGraph.h"
#include "src/dynamic_fusion/sketch/gpu/GpuOperatorGroup.h"
+#include <memory>
+#include <vector>
+
namespace arm_compute
{
namespace experimental
@@ -48,7 +51,8 @@ public:
: _context{ context },
_comp_services{},
_component_graph{ &_comp_services },
- _operator_group{}
+ _operator_group{},
+ _interm_tensor_info_list{ std::vector<std::unique_ptr<TensorInfo>>() }
{
}
/** Prevent instances of this class from being copy constructed */
@@ -97,13 +101,25 @@ public:
{
return component_graph().fuse().write_workload_code();
}
+ /** Create an intermediate tensor info and save it
+ *
+ * @return ITensorInfo The created intermediate tensor info object pointer
+ */
+ ITensorInfo *create_intermediate_tensor()
+ {
+ auto uptr = std::make_unique<TensorInfo>();
+ uptr->set_id(-allocate_new_tensor_id()); // intermediate tensors must have negative id
+ _interm_tensor_info_list.emplace_back(std::move(uptr));
+ return _interm_tensor_info_list.back().get();
+ }
private:
- Context *_context;
- GpuComponentServices _comp_services;
- GpuKernelComponentGraph _component_graph;
- GpuOperatorGroup _operator_group;
- ITensorInfo::Id _next_id{ ITensorInfo::invalid_tensor_id };
+ Context *_context;
+ GpuComponentServices _comp_services;
+ GpuKernelComponentGraph _component_graph;
+ GpuOperatorGroup _operator_group;
+ ITensorInfo::Id _next_id{ ITensorInfo::invalid_tensor_id };
+ std::vector<std::unique_ptr<TensorInfo>> _interm_tensor_info_list;
};
} // namespace dynamic_fusion
} // namespace experimental