NVIDIA DRIVE OS Linux SDK API Reference

6.0.6 Release
nvmedia_dla.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
20 #ifndef NVMEDIA_DLA_H
21 #define NVMEDIA_DLA_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "nvmedia_core.h"
28 #include "nvmedia_tensor.h"
29 
51 #define NVMEDIA_DLA_VERSION_MAJOR 4
52 
53 #define NVMEDIA_DLA_VERSION_MINOR 0
54 
55 #define NVMEDIA_DLA_VERSION_PATCH 0
56 
67 #define NVMEDIA_DLA_TENSOR_DESC_NAME_MAX_LEN (80U)
68 
70 #define NVMEDIA_DLA_DEFAULT_TASKTIMEOUT (100000U)
71 
78 typedef struct NvMediaDla NvMediaDla;
79 
83 typedef struct {
85  uint8_t major;
87  uint8_t minor;
89  uint8_t subMinor;
91 
95 typedef enum {
99 
103 typedef struct {
107 
111 typedef struct {
117 
125 
129 typedef struct {
131  uint8_t const *loadable;
133  uint64_t loadableSize;
135 
139 typedef struct {
143  uint32_t numArgs;
145 
149 typedef struct {
155  uint32_t numAttrs;
157 
192  NvMediaVersion *version
193 );
194 
227  const uint32_t dlaId
228 );
229 
255 NvMediaDla *
256 NvMediaDlaCreate(void);
257 
287  NvMediaDla *dla
288 );
289 
324  const NvMediaDla *dla,
325  NvMediaDlaUMDVersion *version
326 );
327 
360  const NvMediaDla *dla,
361  uint16_t *numEngines
362 );
363 
398  const NvMediaDla *dla,
399  uint32_t *maxOutstandingTasks
400 );
401 
441  NvMediaDla *dla,
442  uint32_t dlaId,
443  uint32_t numTasks
444 );
445 
482  const NvMediaDla *dla,
483  uint32_t *dlaId
484 );
485 
522  const NvMediaDla *dla,
523  uint32_t *numTasks
524 );
525 
559  NvMediaDla *dla,
560  NvMediaDlaLoadable **loadable
561 );
562 
595  const NvMediaDla *dla,
596  NvMediaDlaLoadable *loadable
597 );
598 
643  const NvMediaDla *dla,
644  const NvMediaDlaBinaryLoadable binaryLoadable,
645  NvMediaDlaLoadable *loadable
646 );
647 
690  const NvMediaDla *dla,
691  NvMediaDlaLoadable *loadable
692 );
693 
728  NvMediaDla *dla,
729  const NvMediaDlaLoadable *loadable
730 );
731 
768  const NvMediaDla *dla,
769  int32_t *numOfInputTensors
770 );
771 
811  const NvMediaDla *dla,
812  const uint32_t idx,
813  NvMediaDlaTensorDescriptor *descriptor
814 );
815 
852  const NvMediaDla *dla,
853  int32_t *numOfOutputTensors
854 );
855 
896  const NvMediaDla *dla,
897  const uint32_t idx,
898  NvMediaDlaTensorDescriptor *descriptor
899 );
900 
935  const NvMediaDla *dla,
936  const NvMediaDlaData *dlaData,
937  uint32_t flags
938 );
939 
975  const NvMediaDla *dla,
976  const NvMediaDlaData *dlaData
977 );
978 
1010  NvMediaDla *dla
1011 );
1012 
1046  NvMediaDla *dla
1047 );
1048 
1120  NvMediaDla *dla,
1121  const NvMediaDlaArgs *inputArgs,
1122  const NvMediaDlaArgs *scratchpadArgs,
1123  const NvMediaDlaArgs *outputArgs,
1124  uint32_t taskTimeout
1125 );
1126 
1193  NvMediaDla *dla,
1194  const NvMediaDlaArgs *inputArgs,
1195  const NvMediaDlaArgs *scratchpadArgs,
1196  const NvMediaDlaArgs *outputArgs
1197 );
1198 
1199 /*
1200  * \defgroup history_nvmedia_dla History
1201  * Provides change history for the NvMedia DLA API.
1202  *
1203  * \section history_nvmedia_dla Version History
1204  *
1205  * <b> Version 1.0 </b> Oct 31, 2017
1206  * - Initial Release.
1207  *
1208  * <b> Version 1.1 </b> Feb 12, 2018
1209  * - Add separate functionality to load from memory.
1210  *
1211  * <b> Version 1.2 </b> Mar 12, 2018
1212  * - Add query API's for version, num engines, maxOutstandingRequests.
1213  *
1214  * <c> Version 1.3 </b> Mar 26, 2018
1215  * - Add helper to query tensor descriptor.
1216  *
1217  * <c> Version 1.4 </b> May 3, 2018
1218  * - Add dynamic task timeout support.
1219  *
1220  * <c> Version 2.0 </b> June 26, 2018
1221  * - Remove load using filename functionality.
1222  *
1223  * <c> Version 2.1 </b> August 13, 2018
1224  * - Add NvMediaDlaPingById. NvMediaDlaPing will be deprecated in the future.
1225  *
1226  * <c> Version 2.2 </b> Oct 1, 2018
1227  * - Add new API NvMediaDlaGetUMDVersion and data structure NvMediaDlaUMDVersion.
1228  *
1229  * <c> Version 2.3 </b> Dec 14, 2018
1230  * - Add new API NvMediaLoadableIdCreate, NvMediaLoadableIdDestroy,
1231  * NvMediaDlaAppendLoadable, NvMediaDlaLoadLoadable, NvMediaDlaSetCurrentLoadable,
1232  * NvMediaDlaInit, NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1233  * - Add new structure NvMediaDlaLoadableId, NvMediaDlaLoadable and NvMediaDlaScratchpadDescriptor.
1234  *
1235  * <c> Version 2.4 </b> Jan 9, 2019
1236  * - Remove NvMediaImage as Dla data.
1237  *
1238  * <c> Version 2.5 </b> Mar 7, 2019
1239  * - Rename NvMediaLoadableIdCreate to NvMediaDlaLoadableIdCreate.
1240  * - Rename NvMediaLoadableIdDestroy to NvMediaDlaLoadableIdDestroy.
1241  *
1242  * <c> Version 2.6 </b> Mar 11, 2019
1243  * - Add new API NvMediaDlaDataRegister and NvMediaDlaDataUnRegister.
1244  *
1245  * <c> Version 2.7 </b> Mar 13, 2019
1246  * - Deprecate NvMediaDlaPing API.
1247  *
1248  * <c> Version 2.8 </b> Mar 14, 2019
1249  * - Deprecate NvMediaDlaSubmit API.
1250  *
1251  * <c> Version 3.0 </b> April 19, 2019
1252  * - Add NvMediaDlaSubmit as new API for task submission.
1253  * - Move to new APIs for NvMediaDla programming.
1254  * - Mark NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1255  * and NvMediaDlaGetMaxOutstandingRequests as deprecated APIs.
1256  *
1257  * <c> Version 3.1 </b> July 08, 2019
1258  * - Remove the restriction of calling sequence for data registration.
1259  *
1260  * <c> Version 3.2 </b> July 30, 2019
1261  * - Deleting NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1262  * - added const for parameters in APIs that do not modify the parameter
1263  *
1264  * <c> Version 3.3 </b> Sep 9th, 2019
1265  * - Deprecate following APIs: NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1266  * and NvMediaDlaGetMaxOutstandingRequests
1267  *
1268  * <c> Version 3.4 </b> Jan 22, 2020
1269  * - Add const to NvMediaDlaSubmit to comply with MISRA rule 8.13
1270  *
1271  * <c> Version 3.5 </b> Mar 28, 2020
1272  * - Update possible return status of NvMediaDlaGetNumEngines, NvMediaDlaGetInstanceId,
1273  * NvMediaDlaGetNumTasks, NvMediaDlaSubmit.
1274  *
1275  * <c> Version 3.6 </b> Apr 24, 2020
1276  * - Removed const from NvMediaDlaSetCurrentLoadable and
1277  * NvMediaDlaRemoveLoadable to support new functionality
1278  *
1279  * <c> Version 3.7 </b> Nov 30, 2020
1280  * - Updated doxygen comments for NvMediaDlaSubmit.
1281  *
1282  * <c> Version 3.8 </b> Jan 5, 2021
1283  * - Updated last sentence of NvMediaDlaSubmit restrictions.
1284  *
1285  * <c> Version 3.9 </b> Mar 1, 2021
1286  * - Updated doxy comments for NvMediaDlaSubmit,NvMediaDlaGetInput/OutputTensorDescriptor.
1287  *
1288  * <c> Version 3.10 </b> Mar 22, 2021
1289  * - Updated doxy comments for NvMediaDlaAppendLoadable.
1290  *
1291  * <c> Version 3.11 </b> Jul 20, 2021
1292  * - Added "submit with bypass execution" feature (NvMediaDlaSubmitBypass).
1293  *
1294  * <b> Version 3.12 </b> August 20, 2021
1295  * - Update doxygen comments for All APIs to have Thread safety information and API Group information
1296  *
1297  * <b> Version 4.0 </b> September 2, 2021
1298  * - Adding Const Qualifier for loadable member in NvMediaDlaBinaryLoadable
1299  *
1300  * <b> Version 4.0 </b> February 08, 2022
1301  * - Updated the doxygen comments with usage considerations for all APIs.
1302  *
1303  * <b> Version 4.0 </b> April 04, 2022
1304  * - Updated doxy comments for NvMediaDlaAppendLoadable, NvMediaDlaRemoveLoadable.
1305  * - Updated valid range for structures.
1306  *
1307  * <b> Version 4.0.0 </b> May 10, 2022
1308  * - Added patch version number macro: NVMEDIA_DLA_VERSION_PATCH.
1309  *
1310  */
1315 #ifdef __cplusplus
1316 }
1317 #endif
1318 
1319 #endif // NVMEDIA_DLA_H
NvMediaDlaDataPointer::tensor
NvMediaTensor * tensor
A pointer to NvMediaTensor.
Definition: nvmedia_dla.h:105
NvMediaDlaGetNumOfInputTensors
NvMediaStatus NvMediaDlaGetNumOfInputTensors(const NvMediaDla *dla, int32_t *numOfInputTensors)
Gets the number of input tensors for the current loadable in the NvMediaDla context.
NvMediaDlaUMDVersion::minor
uint8_t minor
Minor version.
Definition: nvmedia_dla.h:87
NvMediaDlaArgs
Holds input and output DLA data.
Definition: nvmedia_dla.h:139
NvMediaDlaSubmit
NvMediaStatus NvMediaDlaSubmit(NvMediaDla *dla, const NvMediaDlaArgs *inputArgs, const NvMediaDlaArgs *scratchpadArgs, const NvMediaDlaArgs *outputArgs, uint32_t taskTimeout)
Submits a job to the DLA to run the network on a set of input NvMediaDla arguments and a timeout valu...
NvMediaDlaDataPointer
Holds pointers to the DLA data.
Definition: nvmedia_dla.h:103
NvMediaDlaDataUnregister
NvMediaStatus NvMediaDlaDataUnregister(const NvMediaDla *dla, const NvMediaDlaData *dlaData)
Unregisters an NvMediaDlaData after use.
NvMediaStatus
NvMediaStatus
Defines all possible error codes.
Definition: nvmedia_core.h:104
NvMediaDlaLoadable
struct NvMediaDlaLoadable NvMediaDlaLoadable
Holds a handle to NvMediaDlaLoadable.
Definition: nvmedia_dla.h:124
NvMediaDlaInit
NvMediaStatus NvMediaDlaInit(NvMediaDla *dla, uint32_t dlaId, uint32_t numTasks)
Configures the context for a particular DLA engine.
NvMediaDlaBinaryLoadable::loadable
const uint8_t * loadable
Pointer to in-memory loadable.
Definition: nvmedia_dla.h:131
NvMediaDlaRemoveLoadable
NvMediaStatus NvMediaDlaRemoveLoadable(NvMediaDla *dla)
Removes the current loadable from the provided NvMediaDla context.
nvmedia_tensor.h
NVIDIA Media Interface: Tensor Processing
NvMediaVersion
Holds NvMedia version information.
Definition: nvmedia_core.h:164
NvMediaDlaUMDVersion
Holds the DLA UMD version.
Definition: nvmedia_dla.h:83
NvMediaDlaArgs::numArgs
uint32_t numArgs
Number of NvMediaDlaData.
Definition: nvmedia_dla.h:143
NvMediaDlaDataRegister
NvMediaStatus NvMediaDlaDataRegister(const NvMediaDla *dla, const NvMediaDlaData *dlaData, uint32_t flags)
Registers an NvMediaDlaData for use with an NvMediaDla handle.
NvMediaDlaAppendLoadable
NvMediaStatus NvMediaDlaAppendLoadable(const NvMediaDla *dla, const NvMediaDlaBinaryLoadable binaryLoadable, NvMediaDlaLoadable *loadable)
Appends a loadable to the NvMediaDla context.
NvMediaDlaUMDVersion::major
uint8_t major
Major version.
Definition: nvmedia_dla.h:85
NvMediaDlaGetNumOfOutputTensors
NvMediaStatus NvMediaDlaGetNumOfOutputTensors(const NvMediaDla *dla, int32_t *numOfOutputTensors)
Gets the number of output tensors for the current loadable in the NvMediaDla context.
NvMediaTensor
struct NvMediaTensor NvMediaTensor
A handle representing tensor objects.
Definition: nvmedia_tensor.h:88
NVM_TENSOR_ATTR_MAX
@ NVM_TENSOR_ATTR_MAX
Defines the maximum number of tensor creation attributes.
Definition: nvmedia_tensor.h:118
nvmedia_core.h
NVIDIA Media Interface: Core
NvMediaDlaGetMaxOutstandingTasks
NvMediaStatus NvMediaDlaGetMaxOutstandingTasks(const NvMediaDla *dla, uint32_t *maxOutstandingTasks)
Returns the maximum number of tasks that can be queued to an instance of an engine.
NvMediaDlaGetNumEngines
NvMediaStatus NvMediaDlaGetNumEngines(const NvMediaDla *dla, uint16_t *numEngines)
Returns the number of DLA hardware engines available.
NvMediaDlaGetInstanceId
NvMediaStatus NvMediaDlaGetInstanceId(const NvMediaDla *dla, uint32_t *dlaId)
Returns the instance id of the NvMediaDla.
NvMediaDlaAppendDiagnosticLoadable
NvMediaStatus NvMediaDlaAppendDiagnosticLoadable(const NvMediaDla *dla, NvMediaDlaLoadable *loadable)
Appends diagnostic loadable to the NvMediaDla context.
NvMediaDlaGetOutputTensorDescriptor
NvMediaStatus NvMediaDlaGetOutputTensorDescriptor(const NvMediaDla *dla, const uint32_t idx, NvMediaDlaTensorDescriptor *descriptor)
Gets the output tensor descriptor for the current loadable in the NvMediaDla context.
NVMEDIA_DLA_TENSOR_DESC_NAME_MAX_LEN
#define NVMEDIA_DLA_TENSOR_DESC_NAME_MAX_LEN
Maximum length of the name of the tensor to store in the descriptor.
Definition: nvmedia_dla.h:67
NvMediaDlaGetUMDVersion
NvMediaStatus NvMediaDlaGetUMDVersion(const NvMediaDla *dla, NvMediaDlaUMDVersion *version)
Returns the version information for the NvMedia DLA UMD library.
NvMediaDlaLoadLoadable
NvMediaStatus NvMediaDlaLoadLoadable(NvMediaDla *dla)
Loads the current loadable to the provided NvMediaDla context.
NvMediaDlaTensorDescriptor::numAttrs
uint32_t numAttrs
Holds the number of tensor attributes in tensorAttrs[ ].
Definition: nvmedia_dla.h:155
NvMediaDlaLoadableCreate
NvMediaStatus NvMediaDlaLoadableCreate(NvMediaDla *dla, NvMediaDlaLoadable **loadable)
Creates a loadable handle.
NvMediaDlaLoadableDestroy
NvMediaStatus NvMediaDlaLoadableDestroy(const NvMediaDla *dla, NvMediaDlaLoadable *loadable)
Destroys a loadable handle.
NvMediaDlaTensorDescriptor
Holds tensor attributes.
Definition: nvmedia_dla.h:149
NvMediaDlaGetVersion
NvMediaStatus NvMediaDlaGetVersion(NvMediaVersion *version)
Returns the version information for the NvMediaDla library.
NvMediaDlaBinaryLoadable::loadableSize
uint64_t loadableSize
Size (in bytes) of in-memory loadable.
Definition: nvmedia_dla.h:133
NvMediaDlaBinaryLoadable
Holds attributes for populating binary loadables for NvMediaDla.
Definition: nvmedia_dla.h:129
NvMediaDlaPingById
NvMediaStatus NvMediaDlaPingById(const uint32_t dlaId)
Checks the status of the DLA engine.
NvMediaDla
struct NvMediaDla NvMediaDla
Holds a handle to the NvMedia DLA device.
Definition: nvmedia_dla.h:78
NvMediaDlaGetInputTensorDescriptor
NvMediaStatus NvMediaDlaGetInputTensorDescriptor(const NvMediaDla *dla, const uint32_t idx, NvMediaDlaTensorDescriptor *descriptor)
Gets the input tensor descriptor for the current loadable in the NvMediaDla context.
NvMediaDlaSubmitBypass
NvMediaStatus NvMediaDlaSubmitBypass(NvMediaDla *dla, const NvMediaDlaArgs *inputArgs, const NvMediaDlaArgs *scratchpadArgs, const NvMediaDlaArgs *outputArgs)
Submits a job to the DLA but its execution is skipped.
NvMediaDlaData::type
NvMediaDlaDataType type
An NvMediaDlaDataType type.
Definition: nvmedia_dla.h:113
NVMEDIA_DLA_DATA_TYPE_TENSOR
@ NVMEDIA_DLA_DATA_TYPE_TENSOR
NvMediaTensor data type.
Definition: nvmedia_dla.h:97
NvMediaDlaDestroy
NvMediaStatus NvMediaDlaDestroy(NvMediaDla *dla)
Destroys a DLA engine instance created by NvMediaDlaCreate().
NvMediaTensorAttr
Holds tensor creation attributes.
Definition: nvmedia_tensor.h:155
NvMediaDlaSetCurrentLoadable
NvMediaStatus NvMediaDlaSetCurrentLoadable(NvMediaDla *dla, const NvMediaDlaLoadable *loadable)
Sets the current loadable for the NvMediaDla.
NvMediaDlaCreate
NvMediaDla * NvMediaDlaCreate(void)
Creates a default context for NvMediaDla.
NvMediaDlaData::pointer
NvMediaDlaDataPointer pointer
A pointer to NvMediaDlaDataPointer.
Definition: nvmedia_dla.h:115
NvMediaDlaDataType
NvMediaDlaDataType
Defines the data types that DLA can operate on.
Definition: nvmedia_dla.h:95
NvMediaDlaGetNumTasks
NvMediaStatus NvMediaDlaGetNumTasks(const NvMediaDla *dla, uint32_t *numTasks)
Returns the number of outstanding tasks of NvMediaDla.
NvMediaDlaUMDVersion::subMinor
uint8_t subMinor
Sub-minor version.
Definition: nvmedia_dla.h:89
NvMediaDlaArgs::dlaData
NvMediaDlaData * dlaData
Pointer to array of NvMediaDlaData.
Definition: nvmedia_dla.h:141
NvMediaDlaData
Specifies the data type and data pointer.
Definition: nvmedia_dla.h:111