snpe-diagview

snpe-diagview loads a DiagLog file generated by snpe-net-run whenever it operates on input tensor data. The DiagLog file contains timing information information for each layer as well as the entire forward propagate time. If the run uses an input list of input tensors, the timing info reported by snpe-diagview is an average over the entire input set.

The snpe-net-run generates a file called “SNPEDiag_0.log”, “SNPEDiag_1.log” … , “SNPEDiag_n.log”, where n corresponds to the nth iteration of the snpe-net-run execution.

usage: snpe-diagview --input_log DIAG_LOG [-h] [--output CSV_FILE]

Reads a diagnostic log and output the contents to stdout

required arguments:
    --input_log     DIAG_LOG
                Diagnostic log file (required)
optional arguments:
    --output        CSV_FILE
                Output CSV file with all diagnostic data (optional)

    --chrometrace   CHROMETRACE_FILE
                Output chrometrace JSON filename (w/out extension) for logs made using profiling level linting (optional)
    --csv_format_version    CSV_FORMAT_VERSION
                Indicates to the tool which CSV format version to output CSVs in. Valid options are: 1 (default), 2.
                This flag is only meaningful in conjunction with the --output flag

The output generated has timings collected at different layers of the stack. Below is the description of the timing markers:

(Please note: Certain backends like DSP or GPU sometimes splits an op into multiple ops in the backend. Sometimes the backends fuse multiple ops into one. Hence a detailed profiling log can display mismatching no of ops and layer mapping.)

../images/snpe_diagview_timing_diagram.png

snpe-dlc-diff

snpe-dlc-diff compares two DLCs and by default outputs some of the following differences in them in a tabular format:

  • unique layers between the two DLCs

  • parameter differences in common layers

  • differences in dimensions of buffers associated with common layers

  • weight differences in common layers

  • output tensor names differences in common layers

  • unique records between the two DLCs (currently checks for AIP records only)

usage: snpe-dlc-diff [-h] -i1 INPUT_DLC_ONE -i2 INPUT_DLC_TWO [-c] [-l] [-p]
                        [-d] [-w] [-o] [-i] [-x] [-s SAVE]

required arguments:
    -i1 INPUT_DLC_ONE, --input_dlc_one INPUT_DLC_ONE
                        path to the first dl container archive
    -i2 INPUT_DLC_TWO, --input_dlc_two INPUT_DLC_TWO
                        path to the second dl container archive

optional arguments:
    -h, --help            show this help message and exit
    -c, --copyrights      compare copyrights between models
    -l, --layers          compare unique layers between models
    -p, --parameters      compare parameter differences between identically
                        named layers
    -d, --dimensions      compare dimension differences between identically
                        named layers
    -w, --weights         compare weight differences between identically named
                        layers.
    -o, --outputs         compare output_tensor name differences names between
                        identically named layers
    -i, --diff_by_id      Overrides the default comparison strategy for diffing
                        2 models components. By default comparison is made
                        between identically named layers. With this option the
                        models are ordered by id and diff is done in order as
                        long as no more than 1 consecutive layers have
                        different layer types.
    -x, --hta             compare HTA records differences in Models
    -s SAVE, --save SAVE  Save the output to a csv file. Specify a target file
                        path.

snpe-dlc-info

snpe-dlc-info outputs layer information from a DLC file, which provides information about the network model.

usage: snpe-dlc-info [-h] -i INPUT_DLC [-s SAVE]

required arguments:
    -i INPUT_DLC, --input_dlc INPUT_DLC
                        path to a DLC file

optional arguments:
    -s SAVE, --save SAVE
                        Save the output to a csv file. Specify a target file path.
    -m, --memory        Show detailed information about memory usage.
    -d, --display_all_encodings
                        Show detailed axis-quantization encoding information.
    -t, --dump_framework_trace
                        Save framework trace info into the csv file that was passed to --save option.

snpe-dlc-viewer

snpe-dlc-viewer visualizes the network structure of a DLC in a web browser.

usage: snpe-dlc-viewer [-h] -i INPUT_DLC [-s]

required arguments:
    -i INPUT_DLC, --input_dlc INPUT_DLC
                        Path to a DLC file

optional arguments:
    -s, --save            Save HTML file. Specify a file name and/or target save path
    -h, --help            Shows this help message and exits

Additional details:

The DLC viewer tool renders the specified network DLC in HTML format that may be viewed on a web browser. On installations that support a native web browser, a browser instance is opened on which the network is automatically rendered. Users can optionally save the HTML content anywhere on their systems and open on a chosen web browser independently at a later time.

  • Features:

    • Graph-based representation of network model with nodes depicting layers and edges depicting buffer connections.

    • Colored legend to indicate layer types.

    • Zoom and drag options available for ease of visualization.

    • Tool-tips upon mouse hover to describe detailed layer parameters.

    • Sections showing metadata from DLC records

  • Supported browsers:

    • Google Chrome

    • Firefox

    • Internet Explorer on Windows

    • Microsoft Edge Browser on Windows

    • Safari on Mac


snpe-platform-validator

DESCRIPTION:
------------
snpe-platform-validator is a tool to check the capabilities of a device. This tool runs on the device,
rather than on the host, and requires a few additional files to be pushed to the device besides its own executable.
Additional details below.


REQUIRED ARGUMENTS:
-------------------
    --runtime <RUNTIME>   Specify the runtime to validate. <RUNTIME> : gpu, dsp, aip, all.

OPTIONAL ARGUMENTS:
-------------------
    --coreVersion         Query the runtime core descriptor.
    --libVersion          Query the runtime core library API.
    --testRuntime         Run diagnostic tests on the specified runtime.
    --targetPath <DIR>    The directory to save output on the device. Defaults to /data/local/tmp/platformValidator/output.
    --debug               Turn on verbose logging.
    --help                Show this help message.
Additional details:
  • Files needed to be pushed to device (Please note, we have to push the Stub.so and Skel.so of appropriate DSP architecture version, e.g., v68, v73) :

    // Android
    bin/aarch64-android/snpe-platform-validator
    lib/aarch64-android/libSnpeHtpV73CalculatorStub.so
    lib/aarch64-android/libSnpeHtpV73Stub.so
    lib/hexagon-${DSP_ARCH}/unsigned/libCalculator_skel.so
    lib/hexagon-${DSP_ARCH}/unsigned/libSnpeHtpV73Skel.so
    
    // Windows
    bin/aarch64-windows-msvc/snpe-platform-validator.exe
    lib/aarch64-windows-msvc/calculator_htp.dll
    lib/aarch64-windows-msvc/SnpeHtpV73Stub.dll
    lib/hexagon-${DSP_ARCH}/unsigned/libCalculator_skel.so
    lib/hexagon-${DSP_ARCH}/unsigned/libSnpeHtpV73Skel.so
    
  • example: for pushing aarch64-android variant to /data/local/tmp/platformValidator

    adb push $SNPE_ROOT/bin/aarch64-android/snpe-platform-validator /data/local/tmp/platformValidator/bin/snpe-platform-validator
    adb push $SNPE_ROOT/lib/aarch64-android/ /data/local/tmp/platformValidator/lib
    adb push $SNPE_ROOT/lib/dsp /data/local/tmp/platformValidator/dsp
    

snpe-platform-validator-py

DESCRIPTION:
------------
snpe-platform-validator is a tool to check the capabilities of a device. The output is saved in a CSV file in the
"Output" directory, in a csv format. Basic logs are also displayed on the console.

REQUIRED ARGUMENTS:
-------------------
    --runtime <RUNTIME>      Specify the runtime to validate. <RUNTIME> : gpu, dsp, aip, all.
    --directory <ARTIFACTS>  Path to the root of the unpacked SDK directory containing the executable and library files.

OPTIONAL ARGUMENTS:
-------------------
    --buildVariant <VARIANT>      Specify the build variant (e.g: aarch64-android) to be validated.
    --deviceId                    Uses the device for running the adb command. Defaults to first device in the adb devices list.
    --coreVersion                 Outputs the version of the runtime that is present on the target.
    --libVersion                  Outputs the library version of the runtime that is present on the target.
    --testRuntime                 Run diagnostic tests on the specified runtime.
    --targetPath <PATH>           The path to be used on the device. Defaults to /data/local/tmp/platformValidator
                                NOTE that this directory will be deleted before proceeding with validation.
    --remoteHost <REMOTEHOST>     Run on remote host through remote adb server. Defaults to localhost.
    --debug                       Set to turn on debug log.

snpe_bench.py

python script snpe_bench.py runs a DLC neural network and collects benchmark performance information.

usage: snpe_bench.py [-h] -c CONFIG_FILE [-o OUTPUT_BASE_DIR_OVERRIDE]
                        [-v DEVICE_ID_OVERRIDE] [-r HOST_NAME] [-a]
                        [-t DEVICE_OS_TYPE_OVERRIDE] [-d] [-s SLEEP]
                        [-b USERBUFFER_MODE] [-p PERFPROFILE] [-l PROFILINGLEVEL]
                        [-json] [-cache]

Run the snpe_bench

required arguments:
    -c CONFIG_FILE, --config_file CONFIG_FILE
                        Path to a valid config file
                        Refer to sample config file config_help.json for more
                        detail on how to fill params in config file

optional arguments:
    -o OUTPUT_BASE_DIR_OVERRIDE, --output_base_dir_override OUTPUT_BASE_DIR_OVERRIDE
                        Sets the output base directory.
    -v DEVICE_ID_OVERRIDE, --device_id_override DEVICE_ID_OVERRIDE
                        Use this device ID instead of the one supplied in config
                        file. Cannot be used with -a
    -r HOST_NAME, --host_name HOST_NAME
                        Hostname/IP of remote machine to which devices are
                        connected.
    -a, --run_on_all_connected_devices_override
                        Runs on all connected devices, currently only support 1.
                        Cannot be used with -v
    -t DEVICE_OS_TYPE_OVERRIDE, --device_os_type_override DEVICE_OS_TYPE_OVERRIDE
                        Specify the target OS type, valid options are
                        ['android-aarch64', 'le', 'le64_gcc4.9',
                        'le_oe_gcc6.4', 'le64_oe_gcc6.4']
    -d, --debug           Set to turn on debug log
    -s SLEEP, --sleep SLEEP
                        Set number of seconds to sleep between runs e.g. 20
                        seconds
    -b USERBUFFER_MODE, --userbuffer_mode USERBUFFER_MODE
                        [EXPERIMENTAL] Enable user buffer mode, default to
                        float, can be tf8exact0
    -p PERFPROFILE, --perfprofile PERFPROFILE
                        Set the benchmark operating mode (balanced, default,
                        sustained_high_performance, high_performance,
                        power_saver, low_power_saver, high_power_saver,
                        extreme_power_saver, low_balanced, system_settings)
    -l PROFILINGLEVEL, --profilinglevel PROFILINGLEVEL
                        Set the profiling level mode (off, basic, moderate, detailed).
                        Default is basic.
    -json, --generate_json
                        Set to produce json output.
    -cache, --enable_init_cache
                        Enable init caching mode to accelerate the network
                        building process. Defaults to disable.

qairt-dlc-diff

qairt-dlc-diff compares two DLCs and by default outputs some of the following differences in them in a tabular format:

  • unique layers between the two DLCs

  • parameter differences in common layers

  • differences in dimensions of buffers associated with common layers

  • weight differences in common layers

  • output tensor names differences in common layers

  • unique records between the two DLCs (currently checks for AIP records only)

usage: qairt-dlc-diff [-h] -i1 -i2 [-c] [-l] [-p] [-d] [-w] [-o] [-i] [-s]

required arguments:
  -i1, --input_dlc_one
                        Path to the first dl container archive.
  -i2, --input_dlc_two
                        Path to the second dl container archive.

optional arguments:
  -c, --compare_copyrights
                        Compare copyrights between models.
  -l, --compare_layers  Compare unique layers between models.
  -p, --compare_parameters
                        Compare parameter differences between identically named layers.
  -d, --compare_dimensions
                        Compare dimension differences between identically named layers.
  -w, --compare_weights
                        Compare weight differences between identically named layers.
  -o, --compare_outputs
                        Compare output_tensor name differences names between identically named layers.
  -i, --enable_diff_by_id
                        Overrides the default comparison strategy for diffing 2 models components.
                        By default comparison is made between identically named layers.
                        With this option the models are ordered by id and diff is done
                        in order as long as no more than 1 consecutive layers have different layer types.
  -s, --save            Save the output to a csv file. Specify a target file path.

qairt-dlc-info

qairt-dlc-info outputs layer information from a DLC file, which provides information about the network model.

usage: qairt-dlc-info [-h] -i [-s] [-m] [-d] [-t]

required arguments:
  -i, --input_dlc       Path to a DLC file.

optional arguments:
  -s, --save            Save the output to a csv file. Specify a target file path.
  -m, --display_memory  Show detailed information about memory usage.
  -d, --display_all_encodings
                        Show detailed axis-quantization encoding information.
  -t, --dump_framework_trace
                        Save framework trace info into the csv file that was passed to --save option.