aboutsummaryrefslogtreecommitdiff
path: root/compute_kernel_writer/include/ckw/types
diff options
context:
space:
mode:
Diffstat (limited to 'compute_kernel_writer/include/ckw/types')
-rw-r--r--compute_kernel_writer/include/ckw/types/ConstantData.h93
-rw-r--r--compute_kernel_writer/include/ckw/types/ConvertPolicy.h41
-rw-r--r--compute_kernel_writer/include/ckw/types/DataType.h50
-rw-r--r--compute_kernel_writer/include/ckw/types/MemoryOperation.h37
-rw-r--r--compute_kernel_writer/include/ckw/types/Operators.h101
-rw-r--r--compute_kernel_writer/include/ckw/types/TargetArchitecture.h40
-rw-r--r--compute_kernel_writer/include/ckw/types/TargetLanguage.h40
-rw-r--r--compute_kernel_writer/include/ckw/types/TensorComponentType.h61
-rw-r--r--compute_kernel_writer/include/ckw/types/TensorDataLayout.h52
-rw-r--r--compute_kernel_writer/include/ckw/types/TensorSamplerTypes.h84
-rw-r--r--compute_kernel_writer/include/ckw/types/TensorStorageType.h46
11 files changed, 645 insertions, 0 deletions
diff --git a/compute_kernel_writer/include/ckw/types/ConstantData.h b/compute_kernel_writer/include/ckw/types/ConstantData.h
new file mode 100644
index 0000000000..ea95049c9e
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/ConstantData.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_CONSTANTDATA_H
+#define CKW_INCLUDE_CKW_TYPES_CONSTANTDATA_H
+
+#include "ckw/Error.h"
+#include "ckw/types/DataType.h"
+
+#include <algorithm>
+#include <cstdint>
+#include <initializer_list>
+#include <iomanip>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <type_traits>
+#include <vector>
+
+namespace ckw
+{
+// Forward Declarations
+class KernelWriter;
+
+class ConstantData
+{
+ using String = std::string;
+ using StringVector = std::vector<String>;
+
+public:
+ /** Templated constructor */
+ template <typename T>
+ ConstantData(std::initializer_list<std::initializer_list<T>> values, DataType data_type);
+
+ /** Templated constructor */
+ template <typename T>
+ ConstantData(const std::vector<std::vector<T>> &values, DataType data_type);
+
+private:
+ /** Validate the given data type and the template type
+ *
+ * @param[in] data_type data type
+ *
+ * @return true if user provided data type and the template type are conformant
+ */
+ template <typename T>
+ bool validate(DataType data_type);
+
+ /** Get the constant data as a 2d vector of string values
+ *
+ * @return a 2d vector of strings that has the string-converted values
+ */
+ const std::vector<StringVector> &values() const;
+
+ /** Get the underlying data type of the constant values
+ *
+ * @return a @ref ckw::DataType object that represents the underlying data type
+ */
+ DataType data_type() const;
+
+ // Friends
+ friend class KernelWriter;
+
+private:
+ // Data members
+ std::vector<StringVector> _values{};
+ DataType _data_type{};
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_CONSTANTDATA_H
diff --git a/compute_kernel_writer/include/ckw/types/ConvertPolicy.h b/compute_kernel_writer/include/ckw/types/ConvertPolicy.h
new file mode 100644
index 0000000000..43a37ff118
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/ConvertPolicy.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_CONVERTPOLICY_H
+#define CKW_INCLUDE_CKW_TYPES_CONVERTPOLICY_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+enum class ConvertPolicy : int32_t
+{
+ None = 0, // No policy specified.
+ Saturate = 1, // Saturated.
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_CONVERTPOLICY_H
diff --git a/compute_kernel_writer/include/ckw/types/DataType.h b/compute_kernel_writer/include/ckw/types/DataType.h
new file mode 100644
index 0000000000..3447dd61d6
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/DataType.h
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2023 Arm Limited.
+*
+* SPDX-License-Identifier: MIT
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to
+* deal in the Software without restriction, including without limitation the
+* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+* sell copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all
+* copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*/
+
+#ifndef CKW_INCLUDE_CKW_DATATYPE_H
+#define CKW_INCLUDE_CKW_DATATYPE_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+/** Compute Kernel Writer data types. This data type is used by the code variables and tensor arguments. */
+enum class DataType : int32_t
+{
+ Unknown = 0x00,
+ Fp32 = 0x11,
+ Fp16 = 0x12,
+ Int32 = 0x21,
+ Int16 = 0x22,
+ Int8 = 0x24,
+ Uint32 = 0x31,
+ Uint16 = 0x32,
+ Uint8 = 0x34,
+ Bool = 0x41
+};
+
+} // namespace ckw
+
+#endif //CKW_INCLUDE_CKW_DATATYPE_H
diff --git a/compute_kernel_writer/include/ckw/types/MemoryOperation.h b/compute_kernel_writer/include/ckw/types/MemoryOperation.h
new file mode 100644
index 0000000000..f93f60c51a
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/MemoryOperation.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_MEMORYOPERATION
+#define CKW_INCLUDE_CKW_TYPES_MEMORYOPERATION
+
+namespace ckw
+{
+enum class MemoryOperation
+{
+ Load = 1,
+ Store = 2
+};
+} // namespace ckw
+
+#endif /* CKW_INCLUDE_CKW_TYPES_MEMORYOPERATION */
diff --git a/compute_kernel_writer/include/ckw/types/Operators.h b/compute_kernel_writer/include/ckw/types/Operators.h
new file mode 100644
index 0000000000..77b0519422
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/Operators.h
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2023 Arm Limited.
+*
+* SPDX-License-Identifier: MIT
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to
+* deal in the Software without restriction, including without limitation the
+* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+* sell copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all
+* copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*/
+
+#ifndef CKW_INCLUDE_CKW_TYPES_OPERATORS_H
+#define CKW_INCLUDE_CKW_TYPES_OPERATORS_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+/** Unary operators and functions. */
+enum class UnaryOp : int32_t
+{
+ LogicalNot = 0x0000, // !
+ BitwiseNot = 0x0001, // ~
+
+ Exp = 0x0010,
+ Tanh = 0x0011,
+ Sqrt = 0x0012,
+ Erf = 0x0013,
+ Fabs = 0x0014,
+ Log = 0x0015,
+ Round = 0x0016,
+ Floor = 0x0017,
+};
+
+/** Assignment operators. */
+enum class AssignmentOp : int32_t
+{
+ Increment = 0x0000, // +=
+ Decrement = 0x0001, // -=
+};
+
+/** Binary operators. */
+enum class BinaryOp : int32_t
+{
+ // Elementwise
+ Add = 0x0000, // +
+ Sub = 0x0001, // -
+ Mul = 0x0002, // *
+ Div = 0x0003, // /
+ Mod = 0x0004, // %
+
+ // Relational
+ Equal = 0x1000, // ==
+ Less = 0x1001, // <
+ LessEqual = 0x1002, // <=
+ Greater = 0x1003, // >
+ GreaterEqual = 0x1004, // >=
+
+ // Algebra
+ MatMul_Nt_Nt = 0x2000, // X
+ MatMul_Nt_T = 0x2001, // X
+ MatMul_T_Nt = 0x2002, // X
+ MatMul_T_T = 0x2003, // X
+ Dot = 0x2004, // .
+
+ // Logical
+ LogicalAnd = 0x3000, // &&
+ LogicalOr = 0x3001, // ||
+
+ // Bitwise
+ BitwiseXOR = 0x4000, // ^
+
+ // Functions
+ Min = 0x8000,
+ Max = 0x8001,
+};
+
+/** Ternary operators. */
+enum class TernaryOp : int32_t
+{
+ Select = 0x0000,
+ Clamp = 0x0001,
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_OPERATORS_H
diff --git a/compute_kernel_writer/include/ckw/types/TargetArchitecture.h b/compute_kernel_writer/include/ckw/types/TargetArchitecture.h
new file mode 100644
index 0000000000..25662a01f0
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TargetArchitecture.h
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2023 Arm Limited.
+*
+* SPDX-License-Identifier: MIT
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to
+* deal in the Software without restriction, including without limitation the
+* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+* sell copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all
+* copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*/
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TARGETARCHITECTURE_H
+#define CKW_INCLUDE_CKW_TYPES_TARGETARCHITECTURE_H
+
+namespace ckw
+{
+
+/** Target platform architecture. */
+enum class TargetArchitecture
+{
+ Unknown,
+ GpuArmMaliValhall,
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TARGETARCHITECTURE_H
diff --git a/compute_kernel_writer/include/ckw/types/TargetLanguage.h b/compute_kernel_writer/include/ckw/types/TargetLanguage.h
new file mode 100644
index 0000000000..1f507573dd
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TargetLanguage.h
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2023 Arm Limited.
+*
+* SPDX-License-Identifier: MIT
+*
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to
+* deal in the Software without restriction, including without limitation the
+* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+* sell copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included in all
+* copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+* SOFTWARE.
+*/
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TARGETLANGUAGE_H
+#define CKW_INCLUDE_CKW_TYPES_TARGETLANGUAGE_H
+
+namespace ckw
+{
+
+/** Target language. */
+enum class TargetLanguage
+{
+ Unknown,
+ OpenCL
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TARGETLANGUAGE_H
diff --git a/compute_kernel_writer/include/ckw/types/TensorComponentType.h b/compute_kernel_writer/include/ckw/types/TensorComponentType.h
new file mode 100644
index 0000000000..7a5031d8c0
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TensorComponentType.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TENSORCOMPONENTTYPE_H
+#define CKW_INCLUDE_CKW_TYPES_TENSORCOMPONENTTYPE_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+/** Compute Kernel Writer tensor component.
+ *
+ * The tensor components are used to access specific backend-agnostic tensor arguments,
+ * such as the tensor dimensions and tensor strides.
+ * The tensor component is represented as an unsigned integer. The value of the integer value
+ * is assigned to retrieve the information through the @ref TensorComponentBitmask.
+ */
+enum class TensorComponentType : uint32_t
+{
+ Unknown = 0x00000000,
+ OffsetFirstElement = 0x01000000,
+ Stride0 = 0x02000001,
+ Stride1 = 0x02000002,
+ Stride2 = 0x02000003,
+ Stride3 = 0x02000004,
+ Stride4 = 0x02000005,
+ Dim0 = 0x04000001,
+ Dim1 = 0x04000002,
+ Dim2 = 0x04000003,
+ Dim3 = 0x04000004,
+ Dim4 = 0x04000005,
+ Dim1xDim2 = 0x08000032,
+ Dim2xDim3 = 0x08000043,
+ Dim1xDim2xDim3 = 0x08000432
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TENSORCOMPONENTTYPE_H
diff --git a/compute_kernel_writer/include/ckw/types/TensorDataLayout.h b/compute_kernel_writer/include/ckw/types/TensorDataLayout.h
new file mode 100644
index 0000000000..532b299910
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TensorDataLayout.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TENSORDATALAYOUT_H
+#define CKW_INCLUDE_CKW_TYPES_TENSORDATALAYOUT_H
+
+namespace ckw
+{
+
+/** Compute Kernel Writer tensor data layout (or memory format) */
+enum class TensorDataLayout
+{
+ Unknown,
+ Nhwc,
+ Ndhwc
+};
+
+/** Compute Kernel Writer tensor data layout component */
+enum class TensorDataLayoutComponent
+{
+ Unknown,
+ N,
+ D,
+ H,
+ W,
+ C,
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TENSORDATALAYOUT_H
diff --git a/compute_kernel_writer/include/ckw/types/TensorSamplerTypes.h b/compute_kernel_writer/include/ckw/types/TensorSamplerTypes.h
new file mode 100644
index 0000000000..512d0b4501
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TensorSamplerTypes.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TENSORSAMPLERTYPES_H
+#define CKW_INCLUDE_CKW_TYPES_TENSORSAMPLERTYPES_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+// This enum class defines how the dimensions of a 3d tensor is mapped into x,y and z coordianates.
+enum class TensorSamplerFormat : int32_t
+{
+ Unknown = 0,
+ Dim0_Dim1xDim2_1 = 1, // Original dimensions 1 and 2 are collapsed onto y-axis
+ Dim0_Dim1_Dim2 = 2 // Original dimensions stays as they're defined. No collapsing.
+};
+
+/** Tensor sampler address mode enum class for X dimension
+ *
+ * The following address modes are available in total:
+ * Unknown
+ * None : The user guarantees that the coordinate is always in-bound
+ * OverlappingMin : (FIXED shapes only) Reduce the load/store length when x == 0 (MIN). The load length will be width % original length
+ * Leftover elements can be handled using overlapping. This involves processing some of the elements in the array twice.
+ * ClampToBorderMaxOnly : Clamp to max value allowed in the corresponding dimension, and construct an if/else guard to prevent out of bound access,
+ * e.g. if( y < size-of-dimension-y ){ <do the operation> }
+ * SkipLessThanZero : Skip loading/storing if the index is less than 0
+ *
+ * Individual dimensions choose which adddress mode to implement in their respective enum classes.
+ */
+enum class TensorSamplerAddressModeX : int32_t
+{
+ Unknown = 0,
+ None = 1,
+ OverlappingMin = 2
+};
+
+/**
+ * Similar to @ref TensorSamplerAddressModeX
+ */
+enum class TensorSamplerAddressModeY : int32_t
+{
+ Unknown = 0,
+ None = 1,
+ OverlappingMin = 2,
+ ClampToBorderMaxOnly = 3,
+ SkipLessThanZero = 4
+};
+
+/**
+ * Similar to @ref TensorSamplerAddressModeX
+ */
+enum class TensorSamplerAddressModeZ : int32_t
+{
+ Unknown = 0,
+ None = 1,
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TENSORSAMPLERTYPES_H
diff --git a/compute_kernel_writer/include/ckw/types/TensorStorageType.h b/compute_kernel_writer/include/ckw/types/TensorStorageType.h
new file mode 100644
index 0000000000..5a2f17d520
--- /dev/null
+++ b/compute_kernel_writer/include/ckw/types/TensorStorageType.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef CKW_INCLUDE_CKW_TYPES_TENSORSTORAGETYPE_H
+#define CKW_INCLUDE_CKW_TYPES_TENSORSTORAGETYPE_H
+
+#include <cstdint>
+
+namespace ckw
+{
+
+/** Compute Kernel Writer tensor storage.
+ * The tensor storage represents the type of tensor memory object.
+ */
+enum class TensorStorageType : uint32_t
+{
+ Unknown = 0x00000000,
+ BufferUint8Ptr = 0x01000000,
+ Texture2dReadOnly = 0x02000001,
+ Texture2dWriteOnly = 0x02000010,
+};
+
+} // namespace ckw
+
+#endif // CKW_INCLUDE_CKW_TYPES_TENSORSTORAGETYPE_H