Snapdragon Neural Processing Engine SDK
Reference Guide
Defining a UDO Package

A UDO package consists primarily of a registration library and one or more implementation libraries. The main idea is that the registration library contains information about the nature of the operations, while the implementation(s) contains the kernels required to execute the operations (see Overview of UDO for more details). A UDO package can be defined via a UDO configuration, which contains a text specification of the operations and paths that will ultimately help define a directory structure that will represent a UDO package. The definition of a UDO package will be discussed in this section, while the creation of a package once its been defined will be deferred to the section on Creating a UDO Package.

UDO Package Config Description

All the fields found in the UDO Config Field Description are replicated for the UDO package config specification. The breakdown of the aforementioned UDO config file is thus a combination of the description found in that section with the addition of two package specific fields. A generic config is included below with the package-specific fields explained. Users should see UDO Config Field Description for more detailed descriptions of the replicated fields, as well as review the associated notes.

{
"UdoPackage_0":
{
"Operators": [
{
"type": "",
"inputs":[
{"name":"", "data_type": "FLOAT_32", "static": true,
"tensor_layout": "NHWC"},
],
"outputs":[
{"name":"","data_type": "FLOAT_32"}
],
"scalar_params": [
{"name":"scalar_param_1", "data_type": "INT_32"}
],
"tensor_params": [
{"name":"tensor_param_1", "data_type": "FLOAT_32",
"tensor_layout": "NHWC"},
],
"core_types": ["CPU", "GPU", "DSP"],
"dsp_arch_types": ["v66", "v68"]
}
],
"UDO_PACKAGE_NAME": "MyCustomUdoPackage",
"UDO_PACKAGE_PATH": "",
"SNPE_UDO_ROOT":""
}
}

Additional fields are explained below:

  • UDO_PACKAGE_NAME: The name of the package containing the UDO.
  • UDO_PACKAGE_PATH: A path to where the UDO package will be saved. If this is not provided the current directory will be used.
  • SNPE_UDO_ROOT: This is an optional variable that lets the tool know where the SnpeUdo API directory is located within the user's environment. This can be set here or as an environment variable.

Notes

  1. The information specified in the config is used to instantiate info data structures which are critical to how SNPE executes a model containing a UDO. This implies a synergy between a UDO package and a model containing a UDO, as such, the recommended strategy is to use the same config for defining a UDO and its corresponding package.
  2. The definition of a package name will determine the names of source files and implementation libraries found in a generated package.
  3. Operation types will determine the names of methods, classes and source files contained in a generated package.
  4. The package core-types are a set of all core-types mentioned for each operator in the package .