blob: e1b469c88e87751081cadc52e9f8c683e8c84729 [file] [log] [blame]
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +00001/*
2 * Copyright (c) 2024 Arm Limited.
3 *
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
25#ifndef ACL_SRC_GPU_CL_KERNELS_CLSCATTERKERNEL_H
26#define ACL_SRC_GPU_CL_KERNELS_CLSCATTERKERNEL_H
27
28#include "arm_compute/function_info/ScatterInfo.h"
29
30#include "src/core/common/Macros.h"
31#include "src/gpu/cl/ClCompileContext.h"
32#include "src/gpu/cl/IClKernel.h"
33
34namespace arm_compute
35{
36namespace opencl
37{
38namespace kernels
39{
Gunes Bayirada32002024-04-24 10:27:13 +010040
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000041class ClScatterKernel : public IClKernel
42{
43public:
44 ClScatterKernel();
45 ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClScatterKernel);
46 /** Initialise the kernel's input and output.
47 *
Mohammed Suhail Munshi73771072024-03-25 15:55:42 +000048 * @note Negative indices are treated as out of bounds.
49 *
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000050 * @param[in] compile_context The compile context to be used.
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000051 * @param[in] updates Input tensor info for the Update matrix. Data type supported: same as @p src
Mohammed Suhail Munshi73771072024-03-25 15:55:42 +000052 * @param[in] indices Input tensor info for the Indices matrix. Data type supported: S32.
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000053 * @param[out] dst Output tensor info. Data type supported: same as @p src
54 * @param[in] info Attributes for Scatter Kernel
55 */
56 void configure(const ClCompileContext &compile_context,
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000057 const ITensorInfo *updates,
58 const ITensorInfo *indices,
59 ITensorInfo *dst,
60 const ScatterInfo &info);
61 /** Static function to check if given info will lead to a valid configuration
62 *
63 * Similar to @ref ClScatterKernel::configure()
64 *
65 * @return a status
66 */
Mohammed Suhail Munshi73771072024-03-25 15:55:42 +000067 static Status
68 validate(const ITensorInfo *updates, const ITensorInfo *indices, const ITensorInfo *dst, const ScatterInfo &info);
Mohammed Suhail Munshi8609ca02024-02-29 17:00:07 +000069
70 // Inherited methods overridden:
71 void run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) override;
72};
73} // namespace kernels
74} // namespace opencl
75} // namespace arm_compute
76
77#endif // ACL_SRC_GPU_CL_KERNELS_CLSCATTERKERNEL_H