diff options
author | Ramy Elgammal <ramy.elgammal@arm.com> | 2022-11-08 02:14:46 +0000 |
---|---|---|
committer | Ramy Elgammal <ramy.elgammal@arm.com> | 2022-11-29 10:24:59 +0000 |
commit | 404462af4ca002ece819161a03a4bdb19a87abf2 (patch) | |
tree | 09cf812530afcbe3fc524ce7eded5f06129e0889 /src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp | |
parent | 03b2971ac69a86f10a1566938d1a25afee15746c (diff) | |
download | ComputeLibrary-404462af4ca002ece819161a03a4bdb19a87abf2.tar.gz |
Adding GpuAdd to dynamic fusion operators
- Provide support for Add operator
- Auto initialize the destination tensor before testing fusion in conv2d
and elementwise binary ops.
Resolves: COMPMID-5518
Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com>
Change-Id: Ibd815020f02b57f88eea7c2921bdcf98605d99c5
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8617
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp')
-rw-r--r-- | src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp b/src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp index 12aa4d1b9f..9cb4ee7815 100644 --- a/src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp +++ b/src/dynamic_fusion/sketch/gpu/operators/GpuConv2d.cpp @@ -23,18 +23,17 @@ */ #include "arm_compute/dynamic_fusion/sketch/gpu/operators/GpuConv2d.h" -#include "arm_compute/core/CL/CLCompileContext.h" #include "arm_compute/core/Validate.h" -#include "arm_compute/core/experimental/Types.h" #include "arm_compute/core/utils/misc/ShapeCalculator.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/dynamic_fusion/sketch/ArgumentPack.h" #include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSketchImpl.h" -#include "src/dynamic_fusion/sketch/gpu/GpuWorkloadSourceCode.h" #include "src/dynamic_fusion/sketch/gpu/components/cl/ClComponentDirectConv2d.h" #include "src/gpu/cl/kernels/gemm/ClGemmHelpers.h" +#include "src/common/utils/Log.h" + namespace arm_compute { namespace experimental @@ -103,18 +102,6 @@ Status GpuConv2d::validate_op(const GpuWorkloadSketch &sketch, { ARM_COMPUTE_RETURN_ERROR_ON(!bia->has_valid_id()); } - - // Perform fusion test - // Pack tensor infos - ArgumentPack<ITensorInfo> tensors; - tensors.add_const_tensor(ACL_SRC_0, src); - tensors.add_const_tensor(ACL_SRC_1, wei); - tensors.add_const_tensor(ACL_SRC_2, bia); - tensors.add_const_tensor(ACL_DST_0, dst); - const auto op = sketch.implementation().operator_group().new_operator(operator_type, tensors); - ARM_COMPUTE_RETURN_ERROR_ON_MSG(!sketch.implementation().operator_group().try_add_operator(op), - "Operator fusion test failed. This operator cannot be fused into the workload"); - // Auto initialize dst tensor info TensorInfo dst_info_to_validate = *dst; const auto data_layout = src->data_layout(); @@ -128,6 +115,17 @@ Status GpuConv2d::validate_op(const GpuWorkloadSketch &sketch, auto_init_if_empty(dst_info_to_validate, src->clone()->set_tensor_shape(shape)); } + // Perform fusion test + // Pack tensor infos + ArgumentPack<ITensorInfo> tensors; + tensors.add_const_tensor(ACL_SRC_0, src); + tensors.add_const_tensor(ACL_SRC_1, wei); + tensors.add_const_tensor(ACL_SRC_2, bia); + tensors.add_const_tensor(ACL_DST_0, &dst_info_to_validate); + const auto op = sketch.implementation().operator_group().new_operator(operator_type, tensors); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(!sketch.implementation().operator_group().try_add_operator(op), + "Operator fusion test failed. This operator cannot be fused into the workload"); + // Check support level // Data type ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(src, 1, DataType::F16, DataType::F32); @@ -176,6 +174,7 @@ void GpuConv2d::create_op(GpuWorkloadSketch &sketch, ITensorInfo *dst, const Conv2dAttributes &attributes) { + ARM_COMPUTE_LOG_PARAMS(src, wei, bia, dst, attributes); // Assert validation ARM_COMPUTE_ERROR_THROW_ON(GpuConv2d::validate_op(sketch, src, wei, bia, dst, attributes)); ARM_COMPUTE_ERROR_ON_NULLPTR(src, wei, dst); |