NVIDIA DRIVE OS Linux SDK API Reference

6.0.9 Release
nvmedia_dla.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2017-2023 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 
194  NvMediaVersion *version
195 );
196 
231  const uint32_t dlaId
232 );
233 
259 NvMediaDla *
260 NvMediaDlaCreate(void);
261 
293  NvMediaDla *dla
294 );
295 
332  const NvMediaDla *dla,
333  NvMediaDlaUMDVersion *version
334 );
335 
370  const NvMediaDla *dla,
371  uint16_t *numEngines
372 );
373 
410  const NvMediaDla *dla,
411  uint32_t *maxOutstandingTasks
412 );
413 
455  NvMediaDla *dla,
456  uint32_t dlaId,
457  uint32_t numTasks
458 );
459 
498  const NvMediaDla *dla,
499  uint32_t *dlaId
500 );
501 
540  const NvMediaDla *dla,
541  uint32_t *numTasks
542 );
543 
579  NvMediaDla *dla,
580  NvMediaDlaLoadable **loadable
581 );
582 
617  const NvMediaDla *dla,
618  NvMediaDlaLoadable *loadable
619 );
620 
668  const NvMediaDla *dla,
669  const NvMediaDlaBinaryLoadable binaryLoadable,
670  NvMediaDlaLoadable *loadable
671 );
672 
717  const NvMediaDla *dla,
718  NvMediaDlaLoadable *loadable
719 );
720 
758  NvMediaDla *dla,
759  const NvMediaDlaLoadable *loadable
760 );
761 
800  const NvMediaDla *dla,
801  int32_t *numOfInputTensors
802 );
803 
845  const NvMediaDla *dla,
846  const uint32_t idx,
847  NvMediaDlaTensorDescriptor *descriptor
848 );
849 
888  const NvMediaDla *dla,
889  int32_t *numOfOutputTensors
890 );
891 
934  const NvMediaDla *dla,
935  const uint32_t idx,
936  NvMediaDlaTensorDescriptor *descriptor
937 );
938 
975  const NvMediaDla *dla,
976  const NvMediaDlaData *dlaData,
977  uint32_t flags
978 );
979 
1017  const NvMediaDla *dla,
1018  const NvMediaDlaData *dlaData
1019 );
1020 
1054  NvMediaDla *dla
1055 );
1056 
1093  NvMediaDla *dla
1094 );
1095 
1169  NvMediaDla *dla,
1170  const NvMediaDlaArgs *inputArgs,
1171  const NvMediaDlaArgs *scratchpadArgs,
1172  const NvMediaDlaArgs *outputArgs,
1173  uint32_t taskTimeout
1174 );
1175 
1244  NvMediaDla *dla,
1245  const NvMediaDlaArgs *inputArgs,
1246  const NvMediaDlaArgs *scratchpadArgs,
1247  const NvMediaDlaArgs *outputArgs
1248 );
1249 
1250 /*
1251  * \defgroup history_nvmedia_dla History
1252  * Provides change history for the NvMedia DLA API.
1253  *
1254  * \section history_nvmedia_dla Version History
1255  *
1256  * <b> Version 1.0 </b> Oct 31, 2017
1257  * - Initial Release.
1258  *
1259  * <b> Version 1.1 </b> Feb 12, 2018
1260  * - Add separate functionality to load from memory.
1261  *
1262  * <b> Version 1.2 </b> Mar 12, 2018
1263  * - Add query API's for version, num engines, maxOutstandingRequests.
1264  *
1265  * <c> Version 1.3 </b> Mar 26, 2018
1266  * - Add helper to query tensor descriptor.
1267  *
1268  * <c> Version 1.4 </b> May 3, 2018
1269  * - Add dynamic task timeout support.
1270  *
1271  * <c> Version 2.0 </b> June 26, 2018
1272  * - Remove load using filename functionality.
1273  *
1274  * <c> Version 2.1 </b> August 13, 2018
1275  * - Add NvMediaDlaPingById. NvMediaDlaPing will be deprecated in the future.
1276  *
1277  * <c> Version 2.2 </b> Oct 1, 2018
1278  * - Add new API NvMediaDlaGetUMDVersion and data structure NvMediaDlaUMDVersion.
1279  *
1280  * <c> Version 2.3 </b> Dec 14, 2018
1281  * - Add new API NvMediaLoadableIdCreate, NvMediaLoadableIdDestroy,
1282  * NvMediaDlaAppendLoadable, NvMediaDlaLoadLoadable, NvMediaDlaSetCurrentLoadable,
1283  * NvMediaDlaInit, NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1284  * - Add new structure NvMediaDlaLoadableId, NvMediaDlaLoadable and NvMediaDlaScratchpadDescriptor.
1285  *
1286  * <c> Version 2.4 </b> Jan 9, 2019
1287  * - Remove NvMediaImage as Dla data.
1288  *
1289  * <c> Version 2.5 </b> Mar 7, 2019
1290  * - Rename NvMediaLoadableIdCreate to NvMediaDlaLoadableIdCreate.
1291  * - Rename NvMediaLoadableIdDestroy to NvMediaDlaLoadableIdDestroy.
1292  *
1293  * <c> Version 2.6 </b> Mar 11, 2019
1294  * - Add new API NvMediaDlaDataRegister and NvMediaDlaDataUnRegister.
1295  *
1296  * <c> Version 2.7 </b> Mar 13, 2019
1297  * - Deprecate NvMediaDlaPing API.
1298  *
1299  * <c> Version 2.8 </b> Mar 14, 2019
1300  * - Deprecate NvMediaDlaSubmit API.
1301  *
1302  * <c> Version 3.0 </b> April 19, 2019
1303  * - Add NvMediaDlaSubmit as new API for task submission.
1304  * - Move to new APIs for NvMediaDla programming.
1305  * - Mark NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1306  * and NvMediaDlaGetMaxOutstandingRequests as deprecated APIs.
1307  *
1308  * <c> Version 3.1 </b> July 08, 2019
1309  * - Remove the restriction of calling sequence for data registration.
1310  *
1311  * <c> Version 3.2 </b> July 30, 2019
1312  * - Deleting NvMediaDlaGetScratchpadDescriptor and NvMediaDlaBindScratchpad.
1313  * - added const for parameters in APIs that do not modify the parameter
1314  *
1315  * <c> Version 3.3 </b> Sep 9th, 2019
1316  * - Deprecate following APIs: NvMediaDlaLoadFromMemory, NvMediaDlaSubmitTimeout
1317  * and NvMediaDlaGetMaxOutstandingRequests
1318  *
1319  * <c> Version 3.4 </b> Jan 22, 2020
1320  * - Add const to NvMediaDlaSubmit to comply with MISRA rule 8.13
1321  *
1322  * <c> Version 3.5 </b> Mar 28, 2020
1323  * - Update possible return status of NvMediaDlaGetNumEngines, NvMediaDlaGetInstanceId,
1324  * NvMediaDlaGetNumTasks, NvMediaDlaSubmit.
1325  *
1326  * <c> Version 3.6 </b> Apr 24, 2020
1327  * - Removed const from NvMediaDlaSetCurrentLoadable and
1328  * NvMediaDlaRemoveLoadable to support new functionality
1329  *
1330  * <c> Version 3.7 </b> Nov 30, 2020
1331  * - Updated doxygen comments for NvMediaDlaSubmit.
1332  *
1333  * <c> Version 3.8 </b> Jan 5, 2021
1334  * - Updated last sentence of NvMediaDlaSubmit restrictions.
1335  *
1336  * <c> Version 3.9 </b> Mar 1, 2021
1337  * - Updated doxy comments for NvMediaDlaSubmit,NvMediaDlaGetInput/OutputTensorDescriptor.
1338  *
1339  * <c> Version 3.10 </b> Mar 22, 2021
1340  * - Updated doxy comments for NvMediaDlaAppendLoadable.
1341  *
1342  * <c> Version 3.11 </b> Jul 20, 2021
1343  * - Added "submit with bypass execution" feature (NvMediaDlaSubmitBypass).
1344  *
1345  * <b> Version 3.12 </b> August 20, 2021
1346  * - Update doxygen comments for All APIs to have Thread safety information and API Group information
1347  *
1348  * <b> Version 4.0 </b> September 2, 2021
1349  * - Adding Const Qualifier for loadable member in NvMediaDlaBinaryLoadable
1350  *
1351  * <b> Version 4.0 </b> February 08, 2022
1352  * - Updated the doxygen comments with usage considerations for all APIs.
1353  *
1354  * <b> Version 4.0 </b> April 04, 2022
1355  * - Updated doxy comments for NvMediaDlaAppendLoadable, NvMediaDlaRemoveLoadable.
1356  * - Updated valid range for structures.
1357  *
1358  * <b> Version 4.0.0 </b> May 10, 2022
1359  * - Added patch version number macro: NVMEDIA_DLA_VERSION_PATCH.
1360  *
1361  */
1366 #ifdef __cplusplus
1367 }
1368 #endif
1369 
1370 #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