blob: 4b4c22fa1d23779c0aeadad606f0f16b32914caf [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/GpuCkwComponentArgument.h"
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010026#include "ckw/Error.h"
27
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010028namespace arm_compute
29{
30namespace experimental
31{
32namespace dynamic_fusion
33{
34
35GpuCkwComponentArgument::GpuCkwComponentArgument()
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010036{
37}
38
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010039GpuCkwComponentArgument::GpuCkwComponentArgument(ckw::TensorOperand &tensor)
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010040 : _tensor(&tensor)
41{
42}
43
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010044GpuCkwComponentArgument &GpuCkwComponentArgument::init_virtual_tensor(ckw::TileOperand &tile, const ckw::TensorTileSampler &tile_sampler)
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010045{
46 CKW_ASSERT(_tile == nullptr);
47
48 _tile = &tile;
49 _tile_sampler = tile_sampler;
50
51 return *this;
52}
53
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010054bool GpuCkwComponentArgument::has_tensor() const
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010055{
56 return _tensor != nullptr;
57}
58
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010059ckw::TensorOperand &GpuCkwComponentArgument::tensor()
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010060{
61 CKW_ASSERT(_tensor != nullptr);
62
63 return *_tensor;
64}
65
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010066const ckw::TensorOperand &GpuCkwComponentArgument::tensor() const
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010067{
68 CKW_ASSERT(_tensor != nullptr);
69
70 return *_tensor;
71}
72
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010073bool GpuCkwComponentArgument::has_tile() const
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010074{
75 return _tile != nullptr;
76}
77
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010078ckw::TileOperand &GpuCkwComponentArgument::tile()
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010079{
80 CKW_ASSERT(_tile != nullptr);
81
82 return *_tile;
83}
84
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010085const ckw::TileOperand &GpuCkwComponentArgument::tile() const
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010086{
87 CKW_ASSERT(_tile != nullptr);
88
89 return *_tile;
90}
91
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010092ckw::TensorTileSampler &GpuCkwComponentArgument::tile_sampler()
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +010093{
94 CKW_ASSERT(_tile != nullptr);
95
96 return _tile_sampler;
97}
98
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +010099const ckw::TensorTileSampler &GpuCkwComponentArgument::tile_sampler() const
Viet-Hoa Dobd4f6b92023-05-30 09:34:32 +0100100{
101 CKW_ASSERT(_tile != nullptr);
102
103 return _tile_sampler;
104}
Viet-Hoa Doce3c48c2023-07-03 13:44:43 +0100105
106} // namespace dynamic_fusion
107} // namespace experimental
108} // namespace arm_compute