Tensor Tiling Library
 
Loading...
Searching...
No Matches
TTL_cpp/TTL_types.h
Go to the documentation of this file.
1/*
2 * TTL_types.h
3 *
4 * Copyright (c) 2025 Mobileye
5 *
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#pragma once
20
21#include "TTL_macros.h"
22#include "TTL_strong_type.h"
23
24/**
25 * @brief Description of a Shape
26 *
27 * A Shape is a 3D description of an object.
28 *
29 * The units are elements
30 */
31struct TTL_shape {
32 /**
33 * @brief Create a description of a Shape
34 *
35 * @see TTL_shape for more information.
36 *
37 * @param width The number of elements of the Tile Shape in the x-axis
38 * @param height The number of elements of the Tile Shape in the y-axis
39 * @param depth The number of elements of the Tile Shape in the z-axis
40 *
41 * @return A TTL_shape describing in Tile Shape requested.
42 */
44
45 /**
46 * @brief A Shape is empty if its width is 0
47 */
48 bool empty() const {
49 return width == 0;
50 }
51
52 TTL_dim width; ///< Number of elements along dimension x.
53 TTL_dim height; ///< Number of rows along dimension y
54 TTL_dim depth; ///< Number of planes along dimension z
55};
56
57/******************************************************
58 * OFFSET
59 *****************************************************/
60
61/**
62 * @brief Description of the 3D offset of an object.
63 *
64 * A offset of an object from some other reference point.
65 *
66 * The units are elements
67 */
68struct TTL_offset {
69 /**
70 * @brief Create a TTL_offset
71 *
72 * @param x The x offset
73 * @param y The y offset
74 * @param z The z offset
75 */
77
78 TTL_offset_dim x; ///< Offset in dimension x.
79 TTL_offset_dim y; ///< Offset in dimension y.
80 TTL_offset_dim z; ///< Offset in dimension z.
81};
82
83/******************************************************
84 * OVERLAP
85 *****************************************************/
86
87typedef unsigned char TTL_overlap_dim; ///< Overlap of a "adjacent" tiles in
88 ///< the unit of elements
89/**
90 * @brief Description of the overlap in 3D space of adjacent tiles.
91 *
92 * TTL_overlap represents the number of overlapped elements between
93 * adjacent tiles in each dimension.
94 *
95 * For example, overlap.x=1 means that every horizontally-adjacent
96 * tiles share elements on one column.
97 *
98 * The type used to hold the overlap between adjacent tiles along all dimensions
99 */
101 /**
102 * @brief Create a 3D Description of a Tile overlap
103 *
104 * @see TTL_overlap for more information.
105 *
106 * @param width ///< Overlap width in elements
107 * @param height ///< Overlap height in elements
108 * @param depth ///< Overlap depth in elements
109 *
110 * @return A TTL_overlap describing in 3D the overlap requested.
111 */
114
115 TTL_overlap_dim width; ///< width overlap in elements
116 TTL_overlap_dim height; ///< height overlap in elements
117 TTL_overlap_dim depth; ///< depth overlap in elements
118};
unsigned char TTL_overlap_dim
uint32_t TTL_dim
The type used to hold the size of an object along any dimension.
int32_t TTL_offset_dim
The type used to hold offsets and origins.
TTL_offset_dim z
Offset in dimension z.
TTL_offset_dim y
Offset in dimension y.
TTL_offset_dim x
Offset in dimension x.
TTL_offset(TTL_offset_dim x=0, TTL_offset_dim y=0, TTL_offset_dim z=0)
Create a TTL_offset.
TTL_overlap_dim depth
depth overlap in elements
TTL_overlap_dim height
height overlap in elements
TTL_overlap_dim width
width overlap in elements
TTL_overlap(const TTL_overlap_dim width=0, const TTL_overlap_dim height=0, const TTL_overlap_dim depth=0)
Create a 3D Description of a Tile overlap.
TTL_dim height
Number of rows along dimension y.
TTL_dim depth
Number of planes along dimension z.
TTL_dim width
Number of elements along dimension x.
bool empty() const
A Shape is empty if its width is 0.
TTL_shape(TTL_dim width=0, TTL_dim height=1, TTL_dim depth=1)
Create a description of a Shape.