From 29254aeb11a76c86449c2f38587e9144b2f2aacb Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Fri, 13 Oct 2023 17:40:32 +0100 Subject: Optimize CL softmax * The new softmax implementation consists of only a single kernel. - There are 2 versions of softmax, one for the x dimension and one for any other dimensions. - Softmax kernel handles both native and quantized data type. Resolves: COMPMID-6447 Signed-off-by: Viet-Hoa Do Change-Id: I4a9ae5bc63f78aebeaa85ee48a0d102c9c245eda Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10489 Tested-by: Arm Jenkins Reviewed-by: SiCong Li Comments-Addressed: Arm Jenkins Benchmark: Arm Jenkins --- arm_compute/runtime/CL/functions/CLSoftmaxLayer.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'arm_compute') diff --git a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h index 70ef1f4402..68541e35c5 100644 --- a/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h +++ b/arm_compute/runtime/CL/functions/CLSoftmaxLayer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021 Arm Limited. + * Copyright (c) 2017-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_CLSOFTMAXLAYER_H -#define ARM_COMPUTE_CLSOFTMAXLAYER_H +#ifndef ACL_ARM_COMPUTE_RUNTIME_CL_FUNCTIONS_CLSOFTMAXLAYER_H +#define ACL_ARM_COMPUTE_RUNTIME_CL_FUNCTIONS_CLSOFTMAXLAYER_H #include "arm_compute/runtime/IFunction.h" #include "arm_compute/runtime/IMemoryManager.h" @@ -43,12 +43,6 @@ class CLCompileContext; * * Log Softmax is calculated by : * @f[ out = (x - max(x) * beta) - log(\sum{e^{x - max(x) * beta}}) @f] - * - * This function runs the following operators/kernels: - * -# If axis is not 0: - * -# @ref opencl::ClPermute - * -# @ref opencl::kernels::ClLogits1DNormKernel - * -# @ref opencl::kernels::ClLogits1DMaxShiftExpSumKernel */ template class CLSoftmaxLayerGeneric : public IFunction @@ -115,4 +109,4 @@ private: using CLSoftmaxLayer = CLSoftmaxLayerGeneric; using CLLogSoftmaxLayer = CLSoftmaxLayerGeneric; } // namespace arm_compute -#endif /* ARM_COMPUTE_CLSOFTMAXLAYER_H */ +#endif // ACL_ARM_COMPUTE_RUNTIME_CL_FUNCTIONS_CLSOFTMAXLAYER_H -- cgit v1.2.1