VAI Trace Usage - 1.3 English

Vitis AI User Guide (UG1414)

Document ID
UG1414
Release Date
2021-02-03
Version
1.3 English

Command Line Usage

# vaitrace --help
usage: Xilinx Vitis AI Trace [-h] [-c [CONFIG]] [-d] [-o [TRACESAVETO]] [-t [TIMEOUT]] [-v]

  cmd		      Command to be traced
  -b                 Bypass mode, just run command and by pass vaitrace, for debug use
  -c [CONFIG]        Specify the configuration file
  -o [TRACESAVETO]   Save trace file to
  -t [TIMEOUT]       Tracing time limitation, default value is 30 for vitis analyzer format, and 5 for .xat format
  --va               Generate trace data for Vitis Analyzer
  --xat              Generate trace data in .xat, for the legacy web based Vitis-AI Profiler, only available for Zynq MPSoC devices

Following are some important and frequently-used arguments:

cmd
cmd is your executable program of Vitis AI that want to be traced.
-t
Controlling the tracing time (in seconds) starting from the [cmd] being launched, the default value is 30. In other words, if no -t is specified for vaitrace, the tracing will stop after [cmd] running for 30 seconds. The [cmd] will continue to run as normal, but it will stop collecting tracing data. It is recommended that trace is about 50~100 images at once because less then 50 may not be enough for some statistic information and more then 100 will slow down the system significantly.
-c
You can start a tracing with more custom options by writing these options on a JSON configuration file and specify the configuration by -c. Details of configuration file will be explained in the next section.

Others arguments are used for debug.

Configuration

It is recommended to use a configuration file to record trace options for vaitrace. You can start a trace with configuration by using vaitrace -c trace_cfg.json.

Configuration priority: Configuration File > Command Line > Default

Here is an example of vaitrace configuration file.

{
  "options”: {
      "runmode": "normal",
      "cmd": "/usr/share/vitis-ai-library/sample/classification/test_jpeg_classification resnet50 sample.jpg",
      "output": "./trace_resnet50.xat",
      "timeout": 3
  },
  "trace": {
      "enable_trace_list": ["vitis-ai-library", "vart", "custom"],
      "trace_custom": []
  }
}
Table 1. Contents of the Configuration File
Key Name Value Type Description
options object Vaitrace options
  cmd string the same with command line argument cmd
output string the same with command line argument -o
timeout integer the same with command line argument -t
runmode string Xmodel run mode control, can be “debug” or “normal”, if runmode == “debug” VART will control xmodel run in a debug mode by using this, user can achieve fine-grained profiling for xmodel.
trace object  
  enable_trace_list list Built-in trace function list to be enabled, available value "vitis-ai-library", "vart", “opencv”, "custom", custom for function in trace_custom list
trace_custom   list The list of functions to be traced that are implemented by user. For the name of function, naming space are supported. You can see an example of using custom trace function later in this document