From 46d44d26183d835d209d7ef1b9023e217dd4019d Mon Sep 17 00:00:00 2001 From: Yair Schwarzbaum Date: Wed, 12 Jan 2022 16:38:58 +0200 Subject: Enable kernel selection testing (Phase #2) Resolves COMPMID-4987 Change-Id: I1201ca3eae107989d13b6a2c6d9560de24fe112d Signed-off-by: Yair Schwarzbaum Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7015 Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins --- src/cpu/kernels/CpuSoftmaxKernel.h | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/cpu/kernels/CpuSoftmaxKernel.h') diff --git a/src/cpu/kernels/CpuSoftmaxKernel.h b/src/cpu/kernels/CpuSoftmaxKernel.h index f317662620..df7d3f7d9b 100644 --- a/src/cpu/kernels/CpuSoftmaxKernel.h +++ b/src/cpu/kernels/CpuSoftmaxKernel.h @@ -23,10 +23,8 @@ */ #ifndef ARM_COMPUTE_CPU_SOFTMAX_KERNEL_H #define ARM_COMPUTE_CPU_SOFTMAX_KERNEL_H - #include "src/core/common/Macros.h" #include "src/cpu/ICpuKernel.h" - namespace arm_compute { namespace cpu @@ -34,8 +32,11 @@ namespace cpu namespace kernels { /** Interface for the identifying the max value of 1D Logits */ -class CpuLogits1DMaxKernel : public NewICpuKernel +class CpuLogits1DMaxKernel : public ICpuKernel { +private: + using SoftmaxLogits1DMaxKernelPtr = std::add_pointer::type; + public: CpuLogits1DMaxKernel() = default; ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuLogits1DMaxKernel); @@ -52,27 +53,31 @@ public: * @return a status */ static Status validate(const ITensorInfo *src, const ITensorInfo *dst); - // Inherited methods overridden: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; const char *name() const override; - -private: - using SoftmaxLogits1DMaxKernelPtr = std::add_pointer::type; + struct SoftmaxLogits1DMaxKernel + { + const char *name; + const DataTypeISASelectorPtr is_selected; + SoftmaxLogits1DMaxKernelPtr ukernel; + }; + static const std::vector &get_available_kernels(); private: SoftmaxLogits1DMaxKernelPtr _run_method{ nullptr }; std::string _name{}; }; - /** Interface for softmax computation for QASYMM8 with pre-computed max. */ template -class CpuLogits1DSoftmaxKernel : public NewICpuKernel> +class CpuLogits1DSoftmaxKernel : public ICpuKernel> { +private: + using SoftmaxLogits1DKernelPtr = std::add_pointer::type; + public: CpuLogits1DSoftmaxKernel() = default; ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuLogits1DSoftmaxKernel); - /** Set the input and output tensors. * * @param[in] src Source tensor info. Data types supported: QASYMM8/QASYMM8_SIGNED/F16/F32. @@ -92,13 +97,16 @@ public: */ static Status validate(const ITensorInfo *src, const ITensorInfo *max, const ITensorInfo *dst, const float beta, const ITensorInfo *tmp); - // Inherited methods overridden: void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override; const char *name() const override; - -private: - using SoftmaxLogits1DKernelPtr = std::add_pointer::type; + struct SoftmaxLogits1DKernel + { + const char *name; + const DataTypeISASelectorPtr is_selected; + SoftmaxLogits1DKernelPtr ukernel; + }; + static const std::vector &get_available_kernels(); private: float _beta{ 1.0f }; -- cgit v1.2.1