diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-19 15:56:00 +0000 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2023-01-24 09:40:01 +0000 |
commit | cc2877368d5e15d9ea89d31c84ec651fc0fffd13 (patch) | |
tree | c57a3a406125b3a31e2d4aff6126ce99f4ade395 /src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp | |
parent | a6a153817302793732e28b07c3b4046df3f91a60 (diff) | |
download | ComputeLibrary-cc2877368d5e15d9ea89d31c84ec651fc0fffd13.tar.gz |
Change dynamic fusion API to return destination tensor info
The new dynamic fusion API is introduced in the following patch:
https://review.mlplatform.org/c/ml/ComputeLibrary/+/8906
For each operator (except Conv2D, which is migrated in the above patch), we
- remove destination tensor from is_supported, validate and create calls
- make create_op return ITensorInfo* to the intermediate destination object
Affected operators:
- DepthwiseConv2D
- Cast
- Elementwise Ops
- Clamp
- Reshape
- Resize
Resolves: COMPMID-5777
Change-Id: Ib60ec8a5f081752808455d7a7d790f2ed0627059
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8991
Reviewed-by: Ramy Elgammal <ramy.elgammal@arm.com>
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Dynamic-Fusion: Ramy Elgammal <ramy.elgammal@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp')
-rw-r--r-- | src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp b/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp index 46033d842b..a02160cba8 100644 --- a/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp +++ b/src/dynamic_fusion/sketch/gpu/operators/GpuAdd.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Arm Limited. + * Copyright (c) 2022-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,8 +26,6 @@ #include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h" #include "src/dynamic_fusion/sketch/gpu/operators/internal/GpuElementwiseBinaryCommon.h" -#include "src/common/utils/Log.h" - namespace arm_compute { namespace experimental @@ -36,37 +34,33 @@ namespace dynamic_fusion { Status GpuAdd::validate_op(const GpuWorkloadSketch &sketch, const ITensorInfo *lhs, - const ITensorInfo *rhs, - const ITensorInfo *dst) + const ITensorInfo *rhs) { + // Set the elementwise operation to ADD then call the elementwise common validate_op ElementwiseBinaryCommonAttributes common_attributes{}; common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); - return GpuElementwiseBinaryCommon::validate_op(sketch, lhs, rhs, dst, common_attributes); + return GpuElementwiseBinaryCommon::validate_op(sketch, lhs, rhs, common_attributes); } Status GpuAdd::is_supported_op(const GpuWorkloadContext &context, const ITensorInfo *lhs, - const ITensorInfo *rhs, - const ITensorInfo *dst) + const ITensorInfo *rhs) { + // Set the elementwise operation to ADD then call the elementwise common is_supported_op ElementwiseBinaryCommonAttributes common_attributes{}; common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); - return GpuElementwiseBinaryCommon::is_supported_op(context, lhs, rhs, dst, common_attributes); + return GpuElementwiseBinaryCommon::is_supported_op(context, lhs, rhs, common_attributes); } -void GpuAdd::create_op(GpuWorkloadSketch &sketch, - ITensorInfo *lhs, - ITensorInfo *rhs, - ITensorInfo *dst) +ITensorInfo *GpuAdd::create_op(GpuWorkloadSketch &sketch, + ITensorInfo *lhs, + ITensorInfo *rhs) { - // Assert validation - ARM_COMPUTE_ERROR_THROW_ON(GpuAdd::validate_op(sketch, lhs, rhs, dst)); - ARM_COMPUTE_LOG_PARAMS(lhs, rhs, dst); - + // No need to log or validate as they'll be handled inside GpuElementwiseBinaryCommon::create_op() // Set the elementwise operation to ADD then call the elementwise common create_op ElementwiseBinaryCommonAttributes common_attributes{}; common_attributes.operation(ElementwiseBinaryCommonAttributes::ElementwiseOp::ADD); - GpuElementwiseBinaryCommon::create_op(sketch, lhs, rhs, dst, common_attributes); + return GpuElementwiseBinaryCommon::create_op(sketch, lhs, rhs, common_attributes); } } // namespace dynamic_fusion |