From 5ba5e0938e68d4f90f5545a81066d56f022b376a Mon Sep 17 00:00:00 2001 From: Gian Marco Iodice Date: Thu, 6 Dec 2018 17:13:09 +0000 Subject: COMPMID-1774: Implement CLGEMMReshapeLHSMatrixKernel to reshape the LHS matrix of GEMM/GEMMLowp Change-Id: I8c5fd4c8bcdffda1522c83158981ed92baa045f4 Reviewed-on: https://review.mlplatform.org/364 Reviewed-by: Michele Di Giorgio Tested-by: Arm Jenkins --- tests/CL/Helper.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests/CL') diff --git a/tests/CL/Helper.h b/tests/CL/Helper.h index 32f9ca00e3..88e716726a 100644 --- a/tests/CL/Helper.h +++ b/tests/CL/Helper.h @@ -24,7 +24,13 @@ #ifndef __ARM_COMPUTE_TEST_CL_HELPER_H__ #define __ARM_COMPUTE_TEST_CL_HELPER_H__ +#include "arm_compute/core/CL/ICLKernel.h" +#include "arm_compute/core/CL/kernels/CLFillBorderKernel.h" +#include "arm_compute/core/CL/kernels/CLMemsetKernel.h" + +#include "arm_compute/runtime/CL/CLScheduler.h" #include "arm_compute/runtime/CL/ICLSimpleFunction.h" +#include "arm_compute/runtime/IFunction.h" #include "support/ToolchainSupport.h" namespace arm_compute @@ -77,6 +83,44 @@ public: _border_handler.configure(first, BorderSize(bordersize), BorderMode::CONSTANT, PixelValue(0)); } }; + +/** As above but this also initializes to zero the input tensor */ +template +class CLSynthetizeFunctionInitOutputWithZeroAndWithZeroConstantBorder : public IFunction +{ +public: + /** Configure the kernel. + * + * @param[in] first First input argument. + * @param[in] second Second input argument. + * @param[in] args Rest of the configuration arguments. + */ + template + void configure(T first, T second, Args &&... args) + { + auto k = arm_compute::support::cpp14::make_unique(); + k->set_target(CLScheduler::get().target()); + k->configure(first, second, std::forward(args)...); + _kernel = std::move(k); + _border_handler.configure(first, BorderSize(bordersize), BorderMode::CONSTANT, PixelValue(0)); + _memset_kernel.configure(second, PixelValue(0)); + } + + // Inherited method overridden: + void run() override final + { + ARM_COMPUTE_ERROR_ON_MSG(!_kernel, "The CL kernel or function isn't configured"); + + CLScheduler::get().enqueue(_memset_kernel, false); + CLScheduler::get().enqueue(_border_handler, false); + CLScheduler::get().enqueue(*_kernel); + } + +private: + CLMemsetKernel _memset_kernel{}; /**< Kernel to initialize the tensor */ + CLFillBorderKernel _border_handler{}; /**< Kernel to handle borders */ + std::unique_ptr _kernel{}; /**< Kernel to run */ +}; } // namespace test } // namespace arm_compute #endif /* __ARM_COMPUTE_TEST_CL_HELPER_H__ */ -- cgit v1.2.1