blob: 57a8a403418a0e929f87e261fcb4686b6cfdafa6 [file] [log] [blame]
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +01001/*
2 * Copyright (c) 2023 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
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010025#ifndef CKW_PROTOTYPE_INCLUDE_CKW_KERNEL_H
26#define CKW_PROTOTYPE_INCLUDE_CKW_KERNEL_H
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010027
28#include "ckw/OperandBase.h"
29#include "ckw/Types.h"
30
31#include <map>
32#include <memory>
33#include <string>
34
35namespace ckw
36{
37
38namespace prototype
39{
40class GpuKernelWriterDataHolder;
41} // namespace prototype
42
43/** The target for kernel writer to write into. */
44class Kernel
45{
46public:
47 /** Constructor
48 *
49 * @param[in] name The name of the kernel function.
50 * @param[in] language The programming language to write the kernel.
51 */
52 Kernel(const char *name, GpuTargetLanguage language);
53
54 /** Destructor */
55 ~Kernel();
56
57 /** Get the name of the kernel function. */
58 const std::string &name() const;
59
60 /** (Internal use only) Get the map from operand name to the operand declared in this kernel. */
61 const ::std::map<::std::string, ::std::unique_ptr<OperandBase>> &operands() const;
62
63 /** (Internal use only) Get the map from operand name to the operand declared in this kernel. */
64 ::std::map<::std::string, ::std::unique_ptr<OperandBase>> &operands();
65
66 /** (Internal use only) Get the implementation data. */
67 prototype::GpuKernelWriterDataHolder *impl();
68
69private:
70 ::std::string _name;
71 ::std::unique_ptr<prototype::GpuKernelWriterDataHolder> _kernel;
72 ::std::map<::std::string, ::std::unique_ptr<OperandBase>> _operands;
73};
74
75} // namespace ckw
76
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010077#endif // CKW_PROTOTYPE_INCLUDE_CKW_KERNEL_H