aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
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 /arm_compute
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 'arm_compute')
-rw-r--r--arm_compute/core/ITensorInfo.h4
-rw-r--r--arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h4
-rw-r--r--arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h27
3 files changed, 19 insertions, 16 deletions
diff --git a/arm_compute/core/ITensorInfo.h b/arm_compute/core/ITensorInfo.h
index ca2837e450..c48e6ebf79 100644
--- a/arm_compute/core/ITensorInfo.h
+++ b/arm_compute/core/ITensorInfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2022 Arm Limited.
+ * Copyright (c) 2016-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -45,7 +45,7 @@ public:
*/
using Id = int32_t;
/** An invalid tensor id within a domain */
- static constexpr Id invalid_tensor_id = -1;
+ static constexpr Id invalid_tensor_id = 0;
/** Get the value representing dynamic dimension state
*
* @return Value representing dynamic dimension state
diff --git a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
index afbe2b8d0b..f19ad6dfc5 100644
--- a/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
+++ b/arm_compute/dynamic_fusion/sketch/gpu/GpuWorkloadSketch.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -83,7 +83,7 @@ public:
*/
TensorInfo create_tensor_info(const ITensorInfo &tensor_info);
/** Create a default @ref TensorInfo associated with the workload sketch
- * It is usually used by a destination tensor whose @ref ITensorInfo is to be inferred automatically
+ * It is usually used by user input or output tensors
*
* @return TensorInfo Newly created tensor info
*/
diff --git a/arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h b/arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h
index 76decfd6cf..4ba237e3be 100644
--- a/arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h
+++ b/arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Arm Limited.
+ * Copyright (c) 2022-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -60,32 +60,35 @@ public:
* @param[in] src Source tensor
* @param[in] wei Weight tensor
* @param[in] bia (Optional) Bias tensor
- * @param[out] dst Destination tensor. If an uninitialized ITensorInfo is passed in, it will be auto-initialized
* @param[in] attributes Operator attributes
+ *
+ * @return pointer for the destination tensor
*/
- static void create_op(GpuWorkloadSketch &sketch,
- ITensorInfo *src,
- ITensorInfo *wei,
- ITensorInfo *bia,
- ITensorInfo *dst,
- const Attributes &attributes);
+ static ITensorInfo *create_op(GpuWorkloadSketch &sketch,
+ ITensorInfo *src,
+ ITensorInfo *wei,
+ ITensorInfo *bia,
+ const Attributes &attributes);
/** Check if the operator configuration is supported, irrespective of fusion
- * Similar to @ref GpuConv2d::create_op()
+ *
+ * @param[in] context Workload context within which the operator is running
+ * @param[in] src Source tensor
+ * @param[in] wei Weight tensor
+ * @param[in] bia (Optional) Bias tensor
+ * @param[in] attributes Operator attributes
*/
static Status is_supported_op(const GpuWorkloadContext &context,
const ITensorInfo *src,
const ITensorInfo *wei,
const ITensorInfo *bia,
- const ITensorInfo *dst,
const Attributes &attributes);
/** Check if the operator configuration is supported and if it can be fused into the workload sketch.
- * Similar to @ref GpuConv2d::create_op()
+ * Similar to @ref GpuConv2d::create_op()
*/
static Status validate_op(const GpuWorkloadSketch &sketch,
const ITensorInfo *src,
const ITensorInfo *wei,
const ITensorInfo *bia,
- const ITensorInfo *dst,
const Attributes &attributes);
};
} // namespace dynamic_fusion