Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
| 34 | namespace arm_compute |
| 35 | { |
| 36 | namespace opencl |
| 37 | { |
| 38 | namespace kernels |
| 39 | { |
Gunes Bayir | ada3200 | 2024-04-24 10:27:13 +0100 | [diff] [blame^] | 40 | |
Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 41 | class ClScatterKernel : public IClKernel |
| 42 | { |
| 43 | public: |
| 44 | ClScatterKernel(); |
| 45 | ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(ClScatterKernel); |
| 46 | /** Initialise the kernel's input and output. |
| 47 | * |
Mohammed Suhail Munshi | 7377107 | 2024-03-25 15:55:42 +0000 | [diff] [blame] | 48 | * @note Negative indices are treated as out of bounds. |
| 49 | * |
Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 50 | * @param[in] compile_context The compile context to be used. |
Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 51 | * @param[in] updates Input tensor info for the Update matrix. Data type supported: same as @p src |
Mohammed Suhail Munshi | 7377107 | 2024-03-25 15:55:42 +0000 | [diff] [blame] | 52 | * @param[in] indices Input tensor info for the Indices matrix. Data type supported: S32. |
Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 53 | * @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 Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 57 | 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 Munshi | 7377107 | 2024-03-25 15:55:42 +0000 | [diff] [blame] | 67 | static Status |
| 68 | validate(const ITensorInfo *updates, const ITensorInfo *indices, const ITensorInfo *dst, const ScatterInfo &info); |
Mohammed Suhail Munshi | 8609ca0 | 2024-02-29 17:00:07 +0000 | [diff] [blame] | 69 | |
| 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 |