TI Deep Learning Product User Guide
tidl_dataflow.h
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) {2015 - 2020} Texas Instruments Incorporated
4 *
5 * All rights reserved not granted herein.
6 *
7 * Limited License.
8 *
9 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
10 * license under copyrights and patents it now or hereafter owns or controls to make,
11 * have made, use, import, offer to sell and sell ("Utilize") this software subject to the
12 * terms herein. With respect to the foregoing patent license, such license is granted
13 * solely to the extent that any such patent is necessary to Utilize the software alone.
14 * The patent license shall not apply to any combinations which include this software,
15 * other than combinations with devices manufactured by or for TI ("TI Devices").
16 * No hardware patent is licensed hereunder.
17 *
18 * Redistributions must preserve existing copyright notices and reproduce this license
19 * (including the above copyright notice and the disclaimer and (if applicable) source
20 * code license limitations below) in the documentation and/or other materials provided
21 * with the distribution
22 *
23 * Redistribution and use in binary form, without modification, are permitted provided
24 * that the following conditions are met:
25 *
26 * * No reverse engineering, decompilation, or disassembly of this software is
27 * permitted with respect to any software provided in binary form.
28 *
29 * * any redistribution and use are licensed by TI for use only with TI Devices.
30 *
31 * * Nothing shall obligate TI to provide you with source code for the software
32 * licensed and provided to you in object code.
33 *
34 * If software source code is provided to you, modification and redistribution of the
35 * source code are permitted provided that the following conditions are met:
36 *
37 * * any redistribution and use of the source code, including any resulting derivative
38 * works, are licensed by TI for use only with TI Devices.
39 *
40 * * any redistribution and use of any object code compiled from the source code
41 * and any resulting derivative works, are licensed by TI for use only with TI Devices.
42 *
43 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers
44 *
45 * may be used to endorse or promote products derived from this software without
46 * specific prior written permission.
47 *
48 * DISCLAIMER.
49 *
50 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
51 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
57 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
58 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
59 * OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
61 */
62 
141 #ifndef TIDL_DATAFLOW_H_
142 #define TIDL_DATAFLOW_H_
143 
144 #include "itidl_ti.h"
145 
146 
147 /* ========================================================================== */
148 /* Include Files */
149 /* ========================================================================== */
150 
151 /* ========================================================================== */
152 /* Macros & Typedefs */
153 /* ========================================================================== */
154 
155 
156 /* ========================================================================== */
157 /* Structure Declarations */
158 /* ========================================================================== */
159 
168 /* Standard fixed point data types */
169 #define TIDL_INT8 ((uint32_t) 0)
170 #define TIDL_INT16 ((uint32_t) 1)
171 #define TIDL_INT32 ((uint32_t) 2)
172 #define TIDL_INT64 ((uint32_t) 3)
173 #define TIDL_UINT8 ((uint32_t) 4)
174 #define TIDL_UINT16 ((uint32_t) 5)
175 #define TIDL_UINT24 ((uint32_t) 6)
176 #define TIDL_UINT32 ((uint32_t) 7)
177 #define TIDL_UINT64 ((uint32_t) 8)
178 /* Standard floating point data types */
179 #define TIDL_FLOAT16 ((uint32_t) 9)
180 #define TIDL_FLOAT32 ((uint32_t) 10)
181 #define TIDL_FLOAT64 ((uint32_t) 11)
182 /* @} */
183 
184 
185 
191 typedef struct
192 {
194  uint32_t data_type;
197  uint32_t dim_x;
200  uint32_t dim_y;
202  int32_t stride_y;
205  uint32_t dim_z;
207  int32_t stride_z;
213 
214 
227 typedef int32_t (*TIDL_DataflowKernelGetHandleSize)(void * pKerInitArgs);
228 
247 typedef int32_t (*TIDL_DataflowKernelInitFuncPtr)(void *kernelHandle,
248  const TIDL_bufParams3D_t *srcAddr,
249  const TIDL_bufParams3D_t *dstAddr,
250  void *pKerInitArgs);
251 
268 typedef int32_t (*TIDL_DataflowKernelExecFuncPtr)(void *kernelHandle,
269  const TIDL_bufParams3D_t *srcAddr,
270  const TIDL_bufParams3D_t *dstAddr,
271  const void *srcPtr[],
272  void *dstPtr);
273 
274 
288 #define TIDL_DataFlowTypeOneTensorInProcOneChannel ((int32_t) 0)
289 
291 #define TIDL_DataFlowTypeOneTensorInProcMultiChannel ((int32_t) 1)
292 
295 #define TIDL_DataFlowTypeMultiTensorInProcOneTensor ((int32_t) 2)
296 
299 #define TIDL_DataFlowTypeMultiTensorInProcMultiTensor ((int32_t) 3)
300 
301 /*NOTE : Current implementation only supports TIDL_DataFlowTypeOneTensorInProcOneChannel */
302 
303 /* @} */
304 
305 
311 typedef struct
312 {
314  int32_t dataFlowType;
339 
340 
341 /* ========================================================================== */
342 /* Internal/Private Function Declarations */
343 /* ========================================================================== */
344 
345 /* None */
346 
347 /* ========================================================================== */
348 /* Function Declarations */
349 /* ========================================================================== */
350 
351 
352 
360 int32_t TIDL_DataflowInit(void * tidlHandle,
361  TIDL_DataflowInitParams * initParams);
362 
372 int32_t TIDL_DataflowProcess(void * tidlHandle,
373  void *inPtrs[],
374  void *outPtr[]);
375 
376 #endif /* TIDL_DATAFLOW_H_*/
377 
TIDL_DataflowKernelInitFuncPtr initFuncPtr
Definition: tidl_dataflow.h:327
int32_t(* TIDL_DataflowKernelExecFuncPtr)(void *kernelHandle, const TIDL_bufParams3D_t *srcAddr, const TIDL_bufParams3D_t *dstAddr, const void *srcPtr[], void *dstPtr)
This function is the main compute function, and performs the argmaxing operation for CNN...
Definition: tidl_dataflow.h:268
uint32_t dim_x
Definition: tidl_dataflow.h:197
float32_tidl * tensorScaleList
Definition: tidl_dataflow.h:209
int32_t dataFlowType
Definition: tidl_dataflow.h:314
int32_t stride_y
Definition: tidl_dataflow.h:202
float float32_tidl
Definition: itidl_ti.h:130
TIDL_DataflowKernelExecFuncPtr execFuncPtr
Definition: tidl_dataflow.h:332
int32_t stride_z
Definition: tidl_dataflow.h:207
int32_t TIDL_DataflowInit(void *tidlHandle, TIDL_DataflowInitParams *initParams)
This function initialized the dataflow handle.
int32_t(* TIDL_DataflowKernelInitFuncPtr)(void *kernelHandle, const TIDL_bufParams3D_t *srcAddr, const TIDL_bufParams3D_t *dstAddr, void *pKerInitArgs)
This function call is required to initialize the handle. In this function most of the one time operat...
Definition: tidl_dataflow.h:247
A structure for a 3 dimensional buffer descriptor.
Definition: tidl_dataflow.h:311
TIDL_DataflowKernelGetHandleSize getHandleSize
Definition: tidl_dataflow.h:317
uint32_t data_type
Definition: tidl_dataflow.h:194
Definition: tidl_dataflow.h:191
int32_t(* TIDL_DataflowKernelGetHandleSize)(void *pKerInitArgs)
This function call is required to know the memroy required by kernel handle.
Definition: tidl_dataflow.h:227
int32_t * tensorZeroPointList
Definition: tidl_dataflow.h:211
uint32_t dim_z
Definition: tidl_dataflow.h:205
void * kernelInitArgs
Definition: tidl_dataflow.h:337
int32_t TIDL_DataflowProcess(void *tidlHandle, void *inPtrs[], void *outPtr[])
This function initialized the dataflow handle.
uint32_t dim_y
Definition: tidl_dataflow.h:200