NVIDIA DRIVE OS Linux SDK API Reference

6.0.5 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 
190  NvMediaVersion *version
191 );
192 
223  const uint32_t dlaId
224 );
225 
249 NvMediaDla *
250 NvMediaDlaCreate(void);
251 
279  NvMediaDla *dla
280 );
281 
314  const NvMediaDla *dla,
315  NvMediaDlaUMDVersion *version
316 );
317 
348  const NvMediaDla *dla,
349  uint16_t *numEngines
350 );
351 
384  const NvMediaDla *dla,
385  uint32_t *maxOutstandingTasks
386 );
387 
425  NvMediaDla *dla,
426  uint32_t dlaId,
427  uint32_t numTasks
428 );
429 
463  const NvMediaDla *dla,
464  uint32_t *dlaId
465 );
466 
500  const NvMediaDla *dla,
501  uint32_t *numTasks
502 );
503 
535  NvMediaDla *dla,
536  NvMediaDlaLoadable **loadable
537 );
538 
569  const NvMediaDla *dla,
570  NvMediaDlaLoadable *loadable
571 );
572 
613  const NvMediaDla *dla,
614  const NvMediaDlaBinaryLoadable binaryLoadable,
615  NvMediaDlaLoadable *loadable
616 );
617 
657  const NvMediaDla *dla,
658  NvMediaDlaLoadable *loadable
659 );
660 
691  NvMediaDla *dla,
692  const NvMediaDlaLoadable *loadable
693 );
694 
727  const NvMediaDla *dla,
728  int32_t *numOfInputTensors
729 );
730 
766  const NvMediaDla *dla,
767  const uint32_t idx,
768  NvMediaDlaTensorDescriptor *descriptor
769 );
770 
803  const NvMediaDla *dla,
804  int32_t *numOfOutputTensors
805 );
806 
843  const NvMediaDla *dla,
844  const uint32_t idx,
845  NvMediaDlaTensorDescriptor *descriptor
846 );
847 
878  const NvMediaDla *dla,
879  const NvMediaDlaData *dlaData,
880  uint32_t flags
881 );
882 
913  const NvMediaDla *dla,
914  const NvMediaDlaData *dlaData
915 );
916 
946  NvMediaDla *dla
947 );
948 
980  NvMediaDla *dla
981 );
982 
1044  NvMediaDla *dla,
1045  const NvMediaDlaArgs *inputArgs,
1046  const NvMediaDlaArgs *scratchpadArgs,
1047  const NvMediaDlaArgs *outputArgs,
1048  uint32_t taskTimeout
1049 );
1050 
1107  NvMediaDla *dla,
1108  const NvMediaDlaArgs *inputArgs,
1109  const NvMediaDlaArgs *scratchpadArgs,
1110  const NvMediaDlaArgs *outputArgs
1111 );
1112 
1113 /*
1114  * \defgroup history_nvmedia_dla History
1115  * Provides change history for the NvMedia DLA API.
1116  *
1117  * \section history_nvmedia_dla Version History
1118  *
1119  * <b> Version 1.0 </b> Oct 31, 2017
1120  * - Initial Release.
1121  *
1122  * <b> Version 1.1 </b> Feb 12, 2018
1123  * - Add separate functionality to load from memory.
1124  *
1125  * <b> Version 1.2 </b> Mar 12, 2018
1126  * - Add query API's for version, num engines, maxOutstandingRequests.
1127  *
1128  * <c> Version 1.3 </b> Mar 26, 2018
1129  * - Add helper to query tensor descriptor.
1130  *
1131  * <c> Version 1.4 </b> May 3, 2018
1132  * - Add dynamic task timeout support.
1133  *
1134  * <c> Version 2.0 </b> June 26, 2018
1135  * - Remove load using filename functionality.
1136  *
1137  * <c> Version 2.1 </b> August 13, 2018
1138  * - Add NvMediaDlaPingById. NvMediaDlaPing will be deprecated in the future.
1139  *
1140  * <c> Version 2.2 </b> Oct 1, 2018
1141  * - Add new API NvMediaDlaGetUMDVersion and data structure NvMediaDlaUMDVersion.
1142  *
1143  * <c> Version 2.3 </b> Dec 14, 2018
1144  * - Add new API NvMediaLoadableIdCreate, NvMediaLoadableIdDestroy,
1145  * NvMediaDlaAppendLoadable, NvMediaDlaLoadLoadable, NvMediaDlaSetCurrentLoadable,
1146  * NvMediaDlaInit, NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1147  * - Add new structure NvMediaDlaLoadableId, NvMediaDlaLoadable and NvMediaDlaScratchpadDescriptor.
1148  *
1149  * <c> Version 2.4 </b> Jan 9, 2019
1150  * - Remove NvMediaImage as Dla data.
1151  *
1152  * <c> Version 2.5 </b> Mar 7, 2019
1153  * - Rename NvMediaLoadableIdCreate to NvMediaDlaLoadableIdCreate.
1154  * - Rename NvMediaLoadableIdDestroy to NvMediaDlaLoadableIdDestroy.
1155  *
1156  * <c> Version 2.6 </b> Mar 11, 2019
1157  * - Add new API NvMediaDlaDataRegister and NvMediaDlaDataUnRegister.
1158  *
1159  * <c> Version 2.7 </b> Mar 13, 2019
1160  * - Deprecate NvMediaDlaPing API.
1161  *
1162  * <c> Version 2.8 </b> Mar 14, 2019
1163  * - Deprecate NvMediaDlaSubmit API.
1164  *
1165  * <c> Version 3.0 </b> April 19, 2019
1166  * - Add NvMediaDlaSubmit as new API for task submission.
1167  * - Move to new APIs for NvMediaDla programming.
1168  * - Mark NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1169  * and NvMediaDlaGetMaxOutstandingRequests as deprecated APIs.
1170  *
1171  * <c> Version 3.1 </b> July 08, 2019
1172  * - Remove the restriction of calling sequence for data registration.
1173  *
1174  * <c> Version 3.2 </b> July 30, 2019
1175  * - Deleting NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1176  * - added const for parameters in APIs that do not modify the parameter
1177  *
1178  * <c> Version 3.3 </b> Sep 9th, 2019
1179  * - Deprecate following APIs: NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1180  * and NvMediaDlaGetMaxOutstandingRequests
1181  *
1182  * <c> Version 3.4 </b> Jan 22, 2020
1183  * - Add const to NvMediaDlaSubmit to comply with MISRA rule 8.13
1184  *
1185  * <c> Version 3.5 </b> Mar 28, 2020
1186  * - Update possible return status of NvMediaDlaGetNumEngines, NvMediaDlaGetInstanceId,
1187  * NvMediaDlaGetNumTasks, NvMediaDlaSubmit.
1188  *
1189  * <c> Version 3.6 </b> Apr 24, 2020
1190  * - Removed const from NvMediaDlaSetCurrentLoadable and
1191  * NvMediaDlaRemoveLoadable to support new functionality
1192  *
1193  * <c> Version 3.7 </b> Nov 30, 2020
1194  * - Updated doxygen comments for NvMediaDlaSubmit.
1195  *
1196  * <c> Version 3.8 </b> Jan 5, 2021
1197  * - Updated last sentence of NvMediaDlaSubmit restrictions.
1198  *
1199  * <c> Version 3.9 </b> Mar 1, 2021
1200  * - Updated doxy comments for NvMediaDlaSubmit,NvMediaDlaGetInput/OutputTensorDescriptor.
1201  *
1202  * <c> Version 3.10 </b> Mar 22, 2021
1203  * - Updated doxy comments for NvMediaDlaAppendLoadable.
1204  *
1205  * <c> Version 3.11 </b> Jul 20, 2021
1206  * - Added "submit with bypass execution" feature (NvMediaDlaSubmitBypass).
1207  *
1208  * <b> Version 3.12 </b> August 20, 2021
1209  * - Update doxygen comments for All APIs to have Thread safety information and API Group information
1210  *
1211  * <b> Version 4.0 </b> September 2, 2021
1212  * - Adding Const Qualifier for loadable member in NvMediaDlaBinaryLoadable
1213  *
1214  * <b> Version 4.0 </b> February 08, 2022
1215  * - Updated the doxygen comments with usage considerations for all APIs.
1216  *
1217  * <b> Version 4.0 </b> April 04, 2022
1218  * - Updated doxy comments for NvMediaDlaAppendLoadable, NvMediaDlaRemoveLoadable.
1219  * - Updated valid range for structures.
1220  *
1221  * <b> Version 4.0.0 </b> May 10, 2022
1222  * - Added patch version number macro: NVMEDIA_DLA_VERSION_PATCH.
1223  *
1224  */
1229 #ifdef __cplusplus
1230 }
1231 #endif
1232 
1233 #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