blob: 7971168d2470f01f5dad8f12f0762d0c9d9601c6 [file] [log] [blame]
Michalis Spyroubcd23522020-05-21 15:02:36 +01001/*
Sheri Zhangac6499a2021-02-10 15:32:38 +00002 * Copyright (c) 2020-2021 Arm Limited.
Michalis Spyroubcd23522020-05-21 15:02:36 +01003 *
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#ifndef ARM_COMPUTE_INEOPERATOR_H
25#define ARM_COMPUTE_INEOPERATOR_H
26
Michalis Spyroubcd23522020-05-21 15:02:36 +010027#include "arm_compute/runtime/IOperator.h"
28#include "arm_compute/runtime/IRuntimeContext.h"
29#include "arm_compute/runtime/Types.h"
30
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010031#include "../../core/ITensor.h"
Michalis Spyroubcd23522020-05-21 15:02:36 +010032#include <memory>
33
34namespace arm_compute
35{
Michalis Spyrouebcebf12020-10-21 00:04:14 +010036class ICPPKernel;
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +000037class Window;
38
Michalis Spyrouebcebf12020-10-21 00:04:14 +010039using INEKernel = ICPPKernel;
Michalis Spyroubcd23522020-05-21 15:02:36 +010040namespace experimental
41{
Michele Di Giorgio33f41fa2021-03-09 14:09:08 +000042/** Basic interface for functions which have a single async CPU kernel */
Michalis Spyroubcd23522020-05-21 15:02:36 +010043class INEOperator : public IOperator
44{
45public:
46 /** Constructor
47 *
48 * @param[in] ctx Runtime context to be used by the function
49 */
50 INEOperator(IRuntimeContext *ctx = nullptr);
51 /** Prevent instances of this class from being copied (As this class contains pointers) */
52 INEOperator(const INEOperator &) = delete;
53 /** Default move constructor */
54 INEOperator(INEOperator &&) = default;
55 /** Prevent instances of this class from being copied (As this class contains pointers) */
56 INEOperator &operator=(const INEOperator &) = delete;
57 /** Default move assignment operator */
58 INEOperator &operator=(INEOperator &&) = default;
Michalis Spyrouebcebf12020-10-21 00:04:14 +010059 /** Default destructor */
60 ~INEOperator();
Michalis Spyroubcd23522020-05-21 15:02:36 +010061
62 // Inherited methods overridden:
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010063 void run(ITensorPack &tensors) override;
64 void prepare(ITensorPack &constants) override;
Georgios Pinitas09cad722020-07-22 12:11:20 +010065 MemoryRequirements workspace() const override;
Michalis Spyroubcd23522020-05-21 15:02:36 +010066
67protected:
Sang-Hoon Park668ccdc2021-02-03 10:32:59 +000068 void run(ITensorPack &tensors, const Window &window);
69
Michalis Spyroubcd23522020-05-21 15:02:36 +010070 std::unique_ptr<INEKernel> _kernel;
71 IRuntimeContext *_ctx;
72 MemoryRequirements _workspace;
73};
74} // namespace experimental
75} // namespace arm_compute
76#endif /*ARM_COMPUTE_INEOPERATOR_H */