NVIDIA DRIVE OS Linux SDK API Reference

5.1.9.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Deep Learning Accelerator

Detailed Description

NvMedia DLA runtime APIs for accessing the DLA hardware engine for deep learning operations.

Modules

 DLA Specific Types
 Defines specific types for DLA.
 

Macros

#define NVMEDIA_DLA_VERSION_MAJOR   3
 Major version number. More...
 
#define NVMEDIA_DLA_VERSION_MINOR   2
 Minor version number. More...
 

Functions

NvMediaStatus NvMediaDlaGetVersion (NvMediaVersion *version)
 Returns the version information for the NvMediaDla library. More...
 
NvMediaStatus NvMediaDlaPingById (const uint32_t dlaId)
 Checks the status of the DLA engine. More...
 
NvMediaDlaNvMediaDlaCreate (void)
 Creates a default context for NvMediaDla. More...
 
NvMediaStatus NvMediaDlaDestroy (NvMediaDla *dla)
 Destroys a DLA engine instance created by NvMediaDlaCreate(). More...
 
NvMediaStatus NvMediaDlaGetUMDVersion (const NvMediaDla *dla, NvMediaDlaUMDVersion *version)
 Returns the version information for the NvMedia DLA UMD library. More...
 
NvMediaStatus NvMediaDlaGetNumEngines (const NvMediaDla *dla, uint16_t *numEngines)
 Returns the number of DLA hardware engines available. More...
 
NvMediaStatus NvMediaDlaGetMaxOutstandingTasks (const NvMediaDla *dla, uint32_t *maxOutstandingTasks)
 Returns the maximum number of tasks that can be queued to an instance of an engine. More...
 
NvMediaStatus NvMediaDlaInit (NvMediaDla *dla, uint32_t dlaId, uint32_t numTasks)
 Configures the context for a particular DLA engine. More...
 
NvMediaStatus NvMediaDlaGetInstanceId (const NvMediaDla *dla, uint32_t *dlaId)
 Returns the instance id of the NvMediaDla. More...
 
NvMediaStatus NvMediaDlaGetNumTasks (const NvMediaDla *dla, uint32_t *numTasks)
 Returns the number of outstanding tasks of NvMediaDla. More...
 
NvMediaStatus NvMediaDlaLoadableCreate (NvMediaDla *dla, NvMediaDlaLoadable **loadable)
 Creates a loadable handle. More...
 
NvMediaStatus NvMediaDlaLoadableDestroy (const NvMediaDla *dla, NvMediaDlaLoadable *loadable)
 Destroys a loadable handle. More...
 
NvMediaStatus NvMediaDlaAppendLoadable (const NvMediaDla *dla, const NvMediaDlaBinaryLoadable binaryLoadable, NvMediaDlaLoadable *loadable)
 Appends a loadable to the NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaSetCurrentLoadable (const NvMediaDla *dla, const NvMediaDlaLoadable *loadable)
 Sets the current loadable for the NvMediaDla. More...
 
NvMediaStatus NvMediaDlaGetNumOfInputTensors (const NvMediaDla *dla, int32_t *numOfInputTensors)
 Gets the number of input tensors for the current loadable in the NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaGetInputTensorDescriptor (const NvMediaDla *dla, const uint32_t idx, NvMediaDlaTensorDescriptor *descriptor)
 Gets the input tensor descriptor for the current loadable in the NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaGetNumOfOutputTensors (const NvMediaDla *dla, int32_t *numOfOutputTensors)
 Gets the number of output tensors for the current loadable in the NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaGetOutputTensorDescriptor (const NvMediaDla *dla, const uint32_t idx, NvMediaDlaTensorDescriptor *descriptor)
 Gets the output tensor descriptor for the current loadable in the NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaDataRegister (const NvMediaDla *dla, const NvMediaDlaData *dlaData, uint32_t flags)
 Registers an NvMediaDlaData for use with an NvMediaDla handle. More...
 
NvMediaStatus NvMediaDlaDataUnregister (const NvMediaDla *dla, const NvMediaDlaData *dlaData)
 Unregisters an NvMediaDlaData after use. More...
 
NvMediaStatus NvMediaDlaLoadLoadable (NvMediaDla *dla)
 Loads the current loadable to the provided NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaRemoveLoadable (const NvMediaDla *dla)
 Removes the current loadable from the provided NvMediaDla context. More...
 
NvMediaStatus NvMediaDlaSubmit (NvMediaDla *dla, const NvMediaDlaArgs *inputArgs, const NvMediaDlaArgs *scratchpadArgs, 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 value. More...
 
NvMediaStatus NvMediaDlaLoadFromMemory (NvMediaDla *dla, uint8_t *loadable, uint64_t loadableSize, uint16_t dlaId, uint32_t numOutstandingRequests)
 Configures the context for a DLA engine, and loads a pre-compiled network (from memory) for DLA use. More...
 
NvMediaStatus NvMediaDlaSubmitTimeout (NvMediaDla *dla, const NvMediaDlaArgs *inputArgs, NvMediaDlaArgs *outputArgs, uint32_t taskTimeout)
 Submits a job to the DLA to run the network with a given a set of NvMediaDla input values and a timeout value. More...
 
NvMediaStatus NvMediaDlaGetMaxOutstandingRequests (const NvMediaDla *dla, uint32_t *maxOutstandingRequests)
 Returns the maximum number of requests that can be queued to an instance of an engine. More...
 

Macro Definition Documentation

#define NVMEDIA_DLA_VERSION_MAJOR   3

Major version number.

Definition at line 47 of file nvmedia_dla.h.

#define NVMEDIA_DLA_VERSION_MINOR   2

Minor version number.

Definition at line 49 of file nvmedia_dla.h.

Function Documentation

NvMediaStatus NvMediaDlaAppendLoadable ( const NvMediaDla dla,
const NvMediaDlaBinaryLoadable  binaryLoadable,
NvMediaDlaLoadable loadable 
)

Appends a loadable to the NvMediaDla context.

NvMediaDlaLoadLoadable() appends the value in loadable and returns to the calling function. Currently, only one loadable can be appended.

The application may call this function only once.

Parameters
[in]dlaA handle to the DLA context.
[in]binaryLoadableHolds an NvMediaDlaBinaryLoadable.
[in,out]loadableA pointer to the NvMediaDlaLoadable. The loadable will be filled by NvMediaDla.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaDla* NvMediaDlaCreate ( void  )

Creates a default context for NvMediaDla.

Use the function NvMediaDlaLoadFromMemory() to initialize the newly-created context for use as an engine instance.

Returns
NvMediaDla A handle to the context.
NvMediaStatus NvMediaDlaDataRegister ( const NvMediaDla dla,
const NvMediaDlaData dlaData,
uint32_t  flags 
)

Registers an NvMediaDlaData for use with an NvMediaDla handle.

Parameters
[in]dlaA handle to the DLA context.
[in]dlaDataA pointer to NvMediaDlaData to register.
[in]flagsReserved for future use.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaDataUnregister ( const NvMediaDla dla,
const NvMediaDlaData dlaData 
)

Unregisters an NvMediaDlaData after use.

Parameters
[in]dlaA handle to the DLA context.
[in]dlaDataA pointer to a registered NvMediaDlaData.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaDestroy ( NvMediaDla dla)

Destroys a DLA engine instance created by NvMediaDlaCreate().

Parameters
[in]dlaA handle to the instance to destroy.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetInputTensorDescriptor ( const NvMediaDla dla,
const uint32_t  idx,
NvMediaDlaTensorDescriptor descriptor 
)

Gets the input tensor descriptor for the current loadable in the NvMediaDla context.

Parameters
[in]dlaA handle to the DLA context.
[in]idxA tensor index.
[out]descriptorDescriptor for the tensor.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetInstanceId ( const NvMediaDla dla,
uint32_t *  dlaId 
)

Returns the instance id of the NvMediaDla.

Parameters
[in]dlaA handle to the DLA context.
[in,out]dlaIdA pointer to the NvMediaDla instance id.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetMaxOutstandingRequests ( const NvMediaDla dla,
uint32_t *  maxOutstandingRequests 
)

Returns the maximum number of requests that can be queued to an instance of an engine.

Note
This API will be deprecated.
Parameters
[in]dlaA handle to the DLA context.
[out]maxOutstandingRequestsA pointer to the maximum requests that can be queued.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetMaxOutstandingTasks ( const NvMediaDla dla,
uint32_t *  maxOutstandingTasks 
)

Returns the maximum number of tasks that can be queued to an instance of an engine.

Parameters
[in]dlaA handle to the DLA context.
[out]maxOutstandingTasksA pointer to the maximum number of tasks that can be queued.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetNumEngines ( const NvMediaDla dla,
uint16_t *  numEngines 
)

Returns the number of DLA hardware engines available.

Parameters
[in]dlaA handle to the DLA context.
[out]numEnginesA pointer to the number of DLA hardware engines.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetNumOfInputTensors ( const NvMediaDla dla,
int32_t *  numOfInputTensors 
)

Gets the number of input tensors for the current loadable in the NvMediaDla context.

Parameters
[in]dlaA handle to the DLA context.
[in,out]numOfInputTensorsThe number of input tensors.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetNumOfOutputTensors ( const NvMediaDla dla,
int32_t *  numOfOutputTensors 
)

Gets the number of output tensors for the current loadable in the NvMediaDla context.

Parameters
[in]dlaA handle to the DLA context.
[in,out]numOfOutputTensorsThe number of output tensors.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetNumTasks ( const NvMediaDla dla,
uint32_t *  numTasks 
)

Returns the number of outstanding tasks of NvMediaDla.

Parameters
[in]dlaA handle to the DLA context.
[in,out]numTasksA pointer to the number of outstanding tasks.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetOutputTensorDescriptor ( const NvMediaDla dla,
const uint32_t  idx,
NvMediaDlaTensorDescriptor descriptor 
)

Gets the output tensor descriptor for the current loadable in the NvMediaDla context.

Parameters
[in]dlaA handle to the DLA context.
[in]idxThe tensor index.
[out]descriptorA descriptor for the tensor.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetUMDVersion ( const NvMediaDla dla,
NvMediaDlaUMDVersion version 
)

Returns the version information for the NvMedia DLA UMD library.

Parameters
[in]dlaA handle to the DLA context.
[in]versionA pointer to an NvMediaDlaUMDVersion structure filled by the NvMediaDla library.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaGetVersion ( NvMediaVersion version)

Returns the version information for the NvMediaDla library.

Parameters
[in]versionA pointer to an NvMediaVersion structure filled by the NvMediaDla library.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaInit ( NvMediaDla dla,
uint32_t  dlaId,
uint32_t  numTasks 
)

Configures the context for a particular DLA engine.

Note
Once the dlaId and numTasks have been assigned, their values cannot be modified.
Parameters
[in]dlaA handle to the DLA context.
[in]dlaIdThe DLA engine ID. Valid range is [0, NvMediaDlaGetNumEngines() - 1].
[in]numTasksThe number of simultaneous tasks that can be submitted to a DLA instance at a time. Valid range is [1, NvMediaDlaGetMaxOutstandingTasks()].
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaLoadableCreate ( NvMediaDla dla,
NvMediaDlaLoadable **  loadable 
)

Creates a loadable handle.

Parameters
[in]dlaA handle to the DLA context.
[in,out]loadableA pointer to the NvMediaDlaLoadable.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaLoadableDestroy ( const NvMediaDla dla,
NvMediaDlaLoadable loadable 
)

Destroys a loadable handle.

Parameters
[in]dlaA handle to the DLA context.
[in]loadableA pointer to the NvMediaDlaLoadable.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaLoadFromMemory ( NvMediaDla dla,
uint8_t *  loadable,
uint64_t  loadableSize,
uint16_t  dlaId,
uint32_t  numOutstandingRequests 
)

Configures the context for a DLA engine, and loads a pre-compiled network (from memory) for DLA use.

Note
This API will be deprecated in a future release.
Parameters
[in]dlaA handle to the DLA context.
[in]loadableA pointer to an in-memory loadable.
[in]loadableSizeSize of the in-memory loadable.
[in]dlaIdDLA engine ID. Valid range: [0, NvMediaDlaGetNumEngines() - 1]
[in]numOutstandingRequestsNumber of outstanding requests. Valid range: [1, NvMediaDlaGetMaxOutstandingRequests()] This determines how many simultaneous requests can be submitted to a DLA instance at a given time.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaLoadLoadable ( NvMediaDla dla)

Loads the current loadable to the provided NvMediaDla context.

The loadable can be made current by calling NvMediaDlaSetCurrentLoadable().

Parameters
[in]dlaA handle to the DLA device.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaPingById ( const uint32_t  dlaId)

Checks the status of the DLA engine.

This function sends a ping to the DLA engine identified by dlaId to fetch its status.

Note
This function is for development only.
Parameters
[in]dlaIdId of the DLA engine to ping.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaRemoveLoadable ( const NvMediaDla dla)

Removes the current loadable from the provided NvMediaDla context.

The loadable can be made current by calling NvMediaDlaSetCurrentLoadable().

This function must be called after a call to NvMediaDlaLoadLoadable().

Parameters
[in]dlaA handle to the DLA context.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaSetCurrentLoadable ( const NvMediaDla dla,
const NvMediaDlaLoadable loadable 
)

Sets the current loadable for the NvMediaDla.

Parameters
[in]dlaA handle to the DLA context.
[in]loadableA pointer to the NvMediaDlaLoadable.
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaSubmit ( NvMediaDla dla,
const NvMediaDlaArgs inputArgs,
const NvMediaDlaArgs scratchpadArgs,
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 value.

Note
The scratchpadArgs is currently not supported.
Parameters
[in]dlaA handle to the DLA context.
[in]inputArgsAn pointer to input NvMediaDlaArgs.
[in]scratchpadArgsA pointer to scratchpad arguments for NvMediaDla.
Note
This parameter is currently not supported. The application must pass NULL in this argument.
Parameters
[in]outputArgsHolds output NvMediaDlaArgs.
[in]taskTimeoutThe maximum time allocated for completing the task (in milliseconds).
Returns
NvMediaStatus, the completion status of the operation:
NvMediaStatus NvMediaDlaSubmitTimeout ( NvMediaDla dla,
const NvMediaDlaArgs inputArgs,
NvMediaDlaArgs outputArgs,
uint32_t  taskTimeout 
)

Submits a job to the DLA to run the network with a given a set of NvMediaDla input values and a timeout value.

Note
This API will be deprecated in a future release.
Parameters
[in]dlaA handle to the DLA context.
[in]inputArgsholds input NvMediaDlaArgs values.
[in]outputArgsHolds output NvMediaDlaArgs values.
[in]taskTimeoutThe maximum time allocated for completing the task (in milliseconds).
Returns
NvMediaStatus, the completion status of the operation: