blob: 3db4fdae84bcb62ae1c1b0e534ee97530f99dfb2 [file] [log] [blame]
Sang-Hoon Park75eea332020-11-13 13:44:13 +00001/*
Michele Di Giorgio1e0208a2021-01-22 15:42:59 +00002 * Copyright (c) 2020-2021 Arm Limited.
Sang-Hoon Park75eea332020-11-13 13:44:13 +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 */
24#include "arm_compute/runtime/CL/functions/CLLogicalOr.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010025
Sang-Hoon Park75eea332020-11-13 13:44:13 +000026#include "arm_compute/core/CL/ICLTensor.h"
Sang-Hoon Park75eea332020-11-13 13:44:13 +000027
ramelg016d891572021-09-29 10:05:09 +010028#include "src/common/utils/Log.h"
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010029#include "src/gpu/cl/kernels/ClElementwiseKernel.h"
ramelg016d891572021-09-29 10:05:09 +010030
Sang-Hoon Park75eea332020-11-13 13:44:13 +000031#include <utility>
32
33namespace arm_compute
34{
35namespace experimental
36{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010037void CLLogicalOr::configure(const CLCompileContext &compile_context,
38 ITensorInfo *input1,
39 ITensorInfo *input2,
40 ITensorInfo *output)
Sang-Hoon Park75eea332020-11-13 13:44:13 +000041{
ramelg016d891572021-09-29 10:05:09 +010042 ARM_COMPUTE_LOG_PARAMS(input1, input2, output);
Michele Di Giorgio1e0208a2021-01-22 15:42:59 +000043 auto k = std::make_unique<arm_compute::opencl::kernels::ClLogicalBinaryKernel>();
44 k->configure(compile_context, LogicalOperation::Or, input1, input2, output);
Sang-Hoon Park75eea332020-11-13 13:44:13 +000045 _kernel = std::move(k);
46}
47
48Status CLLogicalOr::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output)
49{
Michele Di Giorgio1e0208a2021-01-22 15:42:59 +000050 return arm_compute::opencl::kernels::ClLogicalBinaryKernel::validate(LogicalOperation::Or, input1, input2, output);
Sang-Hoon Park75eea332020-11-13 13:44:13 +000051}
52
53void CLLogicalOr::run(ITensorPack &tensors)
54{
55 ICLOperator::run(tensors);
56}
Sang-Hoon Park2dbc5862020-11-18 13:52:11 +000057} // namespace experimental
Sang-Hoon Park75eea332020-11-13 13:44:13 +000058
59struct CLLogicalOr::Impl
60{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010061 const ICLTensor *src0{nullptr};
62 const ICLTensor *src1{nullptr};
63 ICLTensor *dst{nullptr};
64 std::unique_ptr<experimental::CLLogicalOr> op{nullptr};
Sang-Hoon Park75eea332020-11-13 13:44:13 +000065};
66
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010067CLLogicalOr::CLLogicalOr() : _impl(std::make_unique<Impl>())
Sang-Hoon Park75eea332020-11-13 13:44:13 +000068{
69}
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010070CLLogicalOr::CLLogicalOr(CLLogicalOr &&) = default;
Sang-Hoon Park75eea332020-11-13 13:44:13 +000071CLLogicalOr &CLLogicalOr::operator=(CLLogicalOr &&) = default;
72CLLogicalOr::~CLLogicalOr() = default;
73
74void CLLogicalOr::configure(ICLTensor *input1, ICLTensor *input2, ICLTensor *output)
75{
76 configure(CLKernelLibrary::get().get_compile_context(), input1, input2, output);
77}
78
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010079void CLLogicalOr::configure(const CLCompileContext &compile_context,
80 ICLTensor *input1,
81 ICLTensor *input2,
82 ICLTensor *output)
Sang-Hoon Park75eea332020-11-13 13:44:13 +000083{
84 _impl->src0 = input1;
85 _impl->src1 = input2;
86 _impl->dst = output;
Georgios Pinitas40f51a62020-11-21 03:04:18 +000087 _impl->op = std::make_unique<experimental::CLLogicalOr>();
Sang-Hoon Park75eea332020-11-13 13:44:13 +000088 _impl->op->configure(compile_context, input1->info(), input2->info(), output->info());
89}
90
91Status CLLogicalOr::validate(const ITensorInfo *input1, const ITensorInfo *input2, const ITensorInfo *output)
92{
93 return experimental::CLLogicalOr::validate(input1, input2, output);
94}
95
96void CLLogicalOr::run()
97{
98 ITensorPack pack;
99 pack.add_tensor(TensorType::ACL_SRC_0, _impl->src0);
100 pack.add_tensor(TensorType::ACL_SRC_1, _impl->src1);
101 pack.add_tensor(TensorType::ACL_DST, _impl->dst);
102
103 _impl->op->run(pack);
104}
105} // namespace arm_compute