blob: ca4f121566b546184a9bb342250376e4b77751f2 [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#include "src/dynamic_fusion/sketch/gpu/ckw_driver/GpuCkwKernelWriter.h"
26#include "src/dynamic_fusion/sketch/gpu/ckw_driver/GpuCkwComponentArgument.h"
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010027#include "ckw/Error.h"
28#include "ckw/TileInfo.h"
29
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010030namespace arm_compute
31{
32namespace experimental
33{
34namespace dynamic_fusion
35{
36
37GpuCkwKernelWriter::GpuCkwKernelWriter(ckw::Kernel &kernel)
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010038 : KernelWriter(kernel)
39{
40}
41
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010042void GpuCkwKernelWriter::op_load_once(GpuCkwComponentArgument *tensor_or_tile, const ckw::TensorTileSampler &sampler)
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010043{
44 if(!tensor_or_tile->has_tile())
45 {
46 CKW_ASSERT(tensor_or_tile->has_tensor());
47
48 auto &tensor = tensor_or_tile->tensor();
49
50 const auto tile_name = tensor.name() + "_tile";
51 auto &tile = declare_tile(tile_name.c_str(), ckw::TileInfo(tensor.data_type(), sampler.height(), sampler.width()));
52
53 op_load(tile, tensor, sampler);
54
55 tensor_or_tile->init_virtual_tensor(tile, sampler);
56 }
57}
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010058
59} // namespace dynamic_fusion
60} // namespace experimental
61} // namespace arm_compute