From 002e6530f6218b00a28aef9be8b21efb08cf3602 Mon Sep 17 00:00:00 2001 From: Ramy Elgammal Date: Wed, 11 Jan 2023 18:48:04 +0000 Subject: Implement dynamic fusion softmax operator - Return aux tensorInfo by get_aux_tensors() at runtime to init the aux tensor with the right size. - Keep softmax unfusable for this commit - Hence, added Tensor3D to template writer arguments declaration, for sake of keeping dynamic fusion softmax componenets' kernels matching their cl counterparts. Resolves: COMPMID-5523 Change-Id: I667f39545db925f667036ef448302c79a0330373 Signed-off-by: Ramy Elgammal Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/483924 Tested-by: bsgcomp Reviewed-by: Gunes Bayir Comments-Addressed: bsgcomp Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8986 Comments-Addressed: Arm Jenkins Reviewed-by: Jakub Sujak Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- .../components/cl/ClComponentLogits1DMaxShiftExpSum.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp') diff --git a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp index 8ab1853e84..279c77e227 100644 --- a/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp +++ b/src/dynamic_fusion/sketch/gpu/components/cl/ClComponentLogits1DMaxShiftExpSum.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Arm Limited. + * Copyright (c) 2022-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,9 +27,8 @@ #include "arm_compute/core/CL/CLHelpers.h" #include "arm_compute/core/Validate.h" #include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h" +#include "arm_compute/dynamic_fusion/sketch/attributes/SoftmaxAttributes.h" #include "src/core/CL/CLValidate.h" -#include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateDepthwiseConv2d.h" #include "src/dynamic_fusion/sketch/gpu/template_writer/cl/ClTemplateLogits1DMaxShiftExpSum.h" namespace arm_compute @@ -49,7 +48,9 @@ Status ClComponentLogits1DMaxShiftExpSum::validate( const ITensorInfo *sum = tensors.get_const_tensor(TensorType::ACL_DST_0); const ITensorInfo *dst = tensors.get_const_tensor(TensorType::ACL_DST_1); - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, sum, dst); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(sum); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(dst); // 1. Check validity // All tensor infos are initialized @@ -61,11 +62,6 @@ Status ClComponentLogits1DMaxShiftExpSum::validate( ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst, sum); ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(src, dst); - const uint32_t src_dimensions = src->tensor_shape().num_dimensions(); - const uint32_t sum_dimensions = sum->tensor_shape().num_dimensions(); - - ARM_COMPUTE_RETURN_ERROR_ON(src_dimensions != sum_dimensions + 1); - // Device requirements are met ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(src); @@ -94,4 +90,4 @@ const IGpuTemplateComponentWriter *ClComponentLogits1DMaxShiftExpSum::template_w } } // namespace dynamic_fusion } // namespace experimental -} // namespace arm_compute \ No newline at end of file +} // namespace arm_compute -- cgit v1.2.1