Tensor Tiling Library
 
Loading...
Searching...
No Matches
p/pipelines/TTL_schemes_common.h
Go to the documentation of this file.
1/*
2 * TTL_schemes_common.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/**
22 * @def TTL_common_buffering_t
23 * @brief Common data for description of TTL pipelining.
24 *
25 * @param ext_base_type Is the type of the pointer that is the internal base. Generall const 'void *' or 'void *'
26 * @param ext_tensor_in_type Is the type of the external tensor used for import
27 * @param ext_tensor_out_type Is the type of the external tensor used for export
28 * @param int_bases The number of int base address required.
29 *
30 * Contains all the common elements of the pipeline schemes. The more
31 * information that can be made common the more opportunity exists for future
32 * optimizations and development.
33 */
34template <typename TENSORTYPE, unsigned int BASES_COUNT>
36 int index; /*!< Describes the current buffer index when pipelining. For single 0->1->0, for double
37 0->1->0->1... etc */
38 TTL_local(TENSORTYPE *) int_base[BASES_COUNT]; /*!< The internal base addresses of the pipelined tiles. */
39
40 TTL_tensor<TENSORTYPE> ext_tensor_in; /*!< The external tensor being input */
41 TTL_tensor<TENSORTYPE> ext_tensor_out; /*!< The external tensor being output */
42};
43
44/**
45 * @brief Describes a pair of internal Tensors after an operation.
46 *
47 * The most likely usage is that compute input comes from the imported_to
48 * TTL_sub_tensor and the compute output goes to the to_export_from
49 * TTL_sub_tensor.
50 *
51 */
52template <typename TENSORTYPE>
54 /**
55 * @brief Create a TTL_io_tensors from a pair of tensors
56 *
57 * @param imported_to The TTL_sub_tensor that was most recently imported
58 * @param to_export_from The TTL_sub_tensor that will be exported next
59 *
60 * @return A TTL_io_tensors structure
61 */
64
65 bool empty() const {
66 return imported_to.tensor.empty();
67 }
68
69 TTL_sub_tensor<TENSORTYPE> imported_to; ///< The TTL_sub_tensor that was most recently imported
70 TTL_sub_tensor<TENSORTYPE> to_export_from; ///< The TTL_sub_tensor that will be exported next
71};
TTL_tensor< TENSORTYPE > ext_tensor_out
TTL_tensor< TENSORTYPE > ext_tensor_in
TTL_local(TENSORTYPE *) int_base[BASES_COUNT]
TTL_sub_tensor< TENSORTYPE > imported_to
The TTL_sub_tensor that was most recently imported.
TTL_sub_tensor< TENSORTYPE > to_export_from
The TTL_sub_tensor that will be exported next.
TTL_io_tensors(TTL_sub_tensor< TENSORTYPE > imported_to, TTL_sub_tensor< TENSORTYPE > to_export_from)
Create a TTL_io_tensors from a pair of tensors.
A tensor plus its reference to its parent tensor.
A poor mans base class for an a tensor in the passed address space.