# 5 Network compilation **Parent Topic:** https://docs.qualcomm.com/doc/80-PT790-993B/topic/dl_inference_tools_part.html ## 5.1 QAic executor Source: [https://docs.qualcomm.com/doc/80-PT790-993B/topic/network-compilation.html](https://docs.qualcomm.com/doc/80-PT790-993B/topic/network-compilation.html) The QAic executor (qaic-exec) tool runs on x86 platforms and supports the following: - Loading and executing the following model frameworks: - ONNX (onnx, .onnxtxt, external data is also supported) - TensorFlow (.pb, pbtxt) frozen graph - Caffe - Caffe2 - PyTorch TorchScript (.pt) - Generating quantization profile and loading and compilation in one command. - Dumping a quantization profile. - Loading a quantization profile and compiling a model. - Multiple inputs and multiple outputs. - Compiles and executes in both simulator mode and hardware mode. Hardware mode execution uses the QAic runtime APIs provided by the Platform SDK. - Performs AIC100 pre- and postprocessing on host. - Option available to run pre- and postprocessing on AIC100. - Can compile a model of arbitrary batch size to any other specified batch size. - Can generate uniform random inputs and feed to a network if no input files are specified. - All the framework operators that are not supported in a model are listed on the console during a failure. Source code for QAic executor can be found in the following locations: - `/opt/qti-aic/examples/apps/qaic-exec/QAicExec.cpp ` - `/opt/qti-aic/examples/apps/qaic-exec/QAicExecParser.cpp ` - `/opt/qti-aic/examples/apps/qaic-exec/QAicExecParser.h ` The following table shows the options applicable to QAic executor. Table : QAic Executor options | Flag | Use | Example Usage | | --- | --- | --- | | `-u` | Detailed help with options and defaults. | `-u` | | `-m` | Specifies the path of ONNX, Caffe2, TensorFlow (TF), Pytorch Torchscript (\*.pt) model files. | `-m=/tmp/models/test_1/network.onnx ` | | `-model-input` | Specifies the inputs of the graph for Caffe2 models. Optional for ONNX and TF models.



The format is: <inputName1>,<inputType1>,<inputShape1>. | `-model-input=input_03_data,float,[1]` | | `-output-node-name ` | Set this flag to the output node name of the model for intermediate layer outputs.



This option is required for TensorFlow models. | `-output-node-name=out ` | | `-aic-num-cores ` | Number of AIC cores to be used for inference. | `-aic-num-cores=16` | | `-aic-hw ` | Runs inference in Hardware (HW) mode. Without this option, the default is Simulator mode. | `-aic-hw` | | `-run-on-interpreter ` | Runs inference on the interpreter.



Default is Simulator mode. | `-run-on-interpreter ` | | `-aic-hw-version ` | AIC100 hardware version to generate model binary. | `-aic-hw-version=2.0` | | `-ols` | Factor to increasing splitting of network operations. | `-ols=1` | | `-mos` | Effort level to reduce the on-chip memory usage. | `-mos=1` | | `-allocator-dealloc-delay ` | Option to increase buffer lifetime 0 - 10. | `-allocator-dealloc-delay=1 ` | | `-size-split-granularity ` | To set the maximum tile size, KiB between 512 - 2048. | `-size-split-granularity=1024 ` | | `-vtcm-working-set-limit-ratio ` | Ratio of fast memory. An instruction can use {0 - 1}. | `-vtcm-working-set-limit-ratio=0.25 ` | | `-convert-to-fp16 ` | Specifies the model being compiled/executed requires FP16 format. | `-convert-to-fp16` | | `-execute-nodes-in-fp16 ` | Runs all instances of the operators in this list with FP16 precision while in quantization. | `-execute-nodes-in-fp16 ` | | `-node-precision-info` | Load the model loader precision file which contains the first output name of operator instances required to be executed in FP16.



Currently supported for ONNX models only. | `-node-precision-info=node_precision.yaml ` | | `-keep-original-precision-for-nodes` | Run all instances of the operators in this list with the original precision during generation of quantized precision model even if the operator is supported in Int8 precision. | `-keep-original-precision-for-nodes ` | | `-custom-IO-list-file` | Custom I/O configuration file in YAML format containing layout, precision scale and offset for each input and output of the model. | `-custom-IO-list-file=custom_IO_config.yaml ` | | `-dump-custom-IO-config-template` | Dumps the YAML template for custom I/O configuration. This file can be edited as per the custom requirements and passed using the option '`-custom-IO-list-file`'. Model I/O PGQ profile file can also be used with this option to get proper scale and offset values in the dumped YAML template for desired activations quantization schema and calibration. | `-dump-custom-IO-config-template=