blob: 2fb4ba06b693b7b5458c9a5165fe7c0962c6df48 [file] [log] [blame]
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00001/*
Viet-Hoa Do95d477e2023-10-10 15:10:37 +01002 * Copyright (c) 2018-2020, 2023 Arm Limited.
Georgios Pinitas7900a9e2018-11-23 11:44:58 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
Viet-Hoa Do95d477e2023-10-10 15:10:37 +010024#ifndef ACL_SRC_CORE_CL_KERNELS_CLCOMPARISONKERNEL_H
25#define ACL_SRC_CORE_CL_KERNELS_CLCOMPARISONKERNEL_H
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000026
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000027#include "arm_compute/core/Types.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010028
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010029#include "src/core/CL/ICLKernel.h"
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000030
31namespace arm_compute
32{
33// Forward declarations
34class ICLTensor;
35
36/** Interface for the comparison kernel. */
37class CLComparisonKernel : public ICLKernel
38{
39public:
40 /** Default constructor. */
41 CLComparisonKernel();
42 /** Prevent instances of this class from being copied (As this class contains pointers) */
43 CLComparisonKernel(const CLComparisonKernel &) = delete;
44 /** Prevent instances of this class from being copied (As this class contains pointers) */
45 CLComparisonKernel &operator=(const CLComparisonKernel &) = delete;
46 /** Allow instances of this class to be moved */
47 CLComparisonKernel(CLComparisonKernel &&) = default;
48 /** Allow instances of this class to be moved */
49 CLComparisonKernel &operator=(CLComparisonKernel &&) = default;
50 /** Default destructor */
51 ~CLComparisonKernel() = default;
52 /** Set the inputs and output tensors
53 *
Michele Di Giorgiocbbed282019-12-20 13:26:08 +000054 * @param[in] input1 Source tensor. Data types supported: All.
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000055 * @param[in] input2 Source tensor. Data types supported: Same as @p input1.
56 * @param[out] output Destination tensor. Data types supported: U8.
57 * @param[in] operation Comparison operation to use.
58 */
59 void configure(const ICLTensor *input1, const ICLTensor *input2, ICLTensor *output, ComparisonOperation operation);
Manuel Bottini4c6bd512020-04-08 10:15:51 +010060 /** Set the inputs and output tensors
61 *
62 * @param[in] compile_context The compile context to be used.
63 * @param[in] input1 Source tensor. Data types supported: All.
64 * @param[in] input2 Source tensor. Data types supported: Same as @p input1.
65 * @param[out] output Destination tensor. Data types supported: U8.
66 * @param[in] operation Comparison operation to use.
67 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010068 void configure(const CLCompileContext &compile_context,
69 const ICLTensor *input1,
70 const ICLTensor *input2,
71 ICLTensor *output,
72 ComparisonOperation operation);
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000073 /** Static function to check if given info will lead to a valid configuration of @ref CLComparisonKernel
74 *
Michele Di Giorgiocbbed282019-12-20 13:26:08 +000075 * @param[in] input1 Source tensor. Data types supported: All.
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000076 * @param[in] input2 Source tensor. Data types supported: Same as @p input1.
77 * @param[in] output Destination tensor. Data types supported: U8.
78 * @param[in] operation Comparison operation to use.
79 *
80 * @return a status
81 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010082 static Status validate(const ITensorInfo *input1,
83 const ITensorInfo *input2,
84 const ITensorInfo *output,
85 ComparisonOperation operation);
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000086
87 // Inherited methods overridden:
Viet-Hoa Do95d477e2023-10-10 15:10:37 +010088 void run(const Window &window, cl::CommandQueue &queue) override;
Georgios Pinitas7900a9e2018-11-23 11:44:58 +000089
90private:
91 const ICLTensor *_input1; /**< Source tensor 1 */
92 const ICLTensor *_input2; /**< Source tensor 2 */
93 ICLTensor *_output; /**< Destination tensor */
94};
95} // namespace arm_compute
Viet-Hoa Do95d477e2023-10-10 15:10:37 +010096#endif // ACL_SRC_CORE_CL_KERNELS_CLCOMPARISONKERNEL_H