aboutsummaryrefslogtreecommitdiff
path: root/tests/CL
diff options
context:
space:
mode:
authorGian Marco Iodice <gianmarco.iodice@arm.com>2018-12-06 17:13:09 +0000
committerGian Marco Iodice <gianmarco.iodice@arm.com>2018-12-10 15:58:54 +0000
commit5ba5e0938e68d4f90f5545a81066d56f022b376a (patch)
treed828f8b3fd52e6d5b8f732a7ec41f832f0b921d8 /tests/CL
parent1d7cbb99d2a34abd15f3b6c2e017115736cd90cc (diff)
downloadComputeLibrary-5ba5e0938e68d4f90f5545a81066d56f022b376a.tar.gz
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 <michele.digiorgio@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/CL')
-rw-r--r--tests/CL/Helper.h44
1 files changed, 44 insertions, 0 deletions
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 <typename K, int bordersize>
+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 <typename T, typename... Args>
+ void configure(T first, T second, Args &&... args)
+ {
+ auto k = arm_compute::support::cpp14::make_unique<K>();
+ k->set_target(CLScheduler::get().target());
+ k->configure(first, second, std::forward<Args>(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<ICLKernel> _kernel{}; /**< Kernel to run */
+};
} // namespace test
} // namespace arm_compute
#endif /* __ARM_COMPUTE_TEST_CL_HELPER_H__ */