blob: 3a9f4f57225c1e31d1414771390c6ead27b8624d [file] [log] [blame]
Gunes Bayire4211672023-07-25 10:37:13 +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
25#ifndef CKW_INCLUDE_CKW_TENSORSAMPLERTYPES_H
26#define CKW_INCLUDE_CKW_TENSORSAMPLERTYPES_H
27
28#include <cstdint>
29
30namespace ckw
31{
32
33// This enum class defines how the dimensions of a 3d tensor is mapped into x,y and z coordianates.
34enum class TensorSamplerFormat : int32_t
35{
Gunes Bayir5e842512023-07-25 22:32:05 +010036 Unknown = 0,
37 Dim0_Dim1xDim2_1 = 1, // Original dimensions 1 and 2 are collapsed onto y-axis
38 Dim0_Dim1_Dim2 = 2 // Original dimensions stays as they're defined. No collapsing.
Gunes Bayire4211672023-07-25 10:37:13 +010039};
40
41/** Tensor sampler address mode enum class for X dimension
42 *
43 * The following address modes are available in total:
44 * Unknown
45 * None : The user guarantees that the coordinate is always in-bound
46 * OverlappingMin : (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
47 * Leftover elements can be handled using overlapping. This involves processing some of the elements in the array twice.
48 * ClampToBorderMaxOnly : Clamp to max value allowed in the corresponding dimension, and construct an if/else guard to prevent out of bound access,
49 * e.g. if( y < size-of-dimension-y ){ <do the operation> }
50 *
51 * Individual dimensions choose which adddress mode to implement in their respective enum classes.
52 */
53enum class TensorSamplerAddressModeX : int32_t
54{
55 Unknown = 0,
Gunes Bayir5e842512023-07-25 22:32:05 +010056 None = 1,
57 OverlappingMin = 2
Gunes Bayire4211672023-07-25 10:37:13 +010058};
59
60/**
61 * Similar to @ref TensorSamplerAddressModeX
62 */
63enum class TensorSamplerAddressModeY : int32_t
64{
65 Unknown = 0,
66 None = 1,
67 OverlappingMin = 2,
68 ClampToBorderMaxOnly = 3
69};
70
71/**
72 * Similar to @ref TensorSamplerAddressModeX
73 */
74enum class TensorSamplerAddressModeZ : int32_t
75{
76 Unknown = 0,
77 None = 1,
78};
79
80} // namespace ckw
81
82#endif //CKW_INCLUDE_CKW_TENSORSAMPLERTYPES_H