qaic-qpc

The QAic QPC tool (qaic-qpc) is used to inspect QAic Program Container (QPC) binaries generated by the QAic compiler. The tool can also be used to optionally repackage (build) intermediate compiler artifacts into a QPC binary. QPC binaries are passed to the QAic runtime for execution. QAic QPC tool also provides an unpack feature to extract individual files from a single QPC binary. Validation features include network descriptor, network descriptor to metadata, and metadata to hardware installed on the system and to provide model information.

Precompiled network binaries such as those located in the/opt/qti-aic/test-data folder or generated by the Cloud AI 100 Apps SDK can be used to test.

Test files for precompiled network binaries:

/opt/qti-aic/test-data/aic100/v2

Examples

  • List segments from a QPC file:

sudo /opt/qti-aic/tools/qaic-qpc ls --qpc /opt/qti-aic/test-data/aic100/v2/14nsp/14nsp-quant-resnet50/programqpc.bin
  • Extract segments from a QPC file:

sudo /opt/qti-aic/tools/qaic-qpc extract --qpc /opt/qti-aic/test-data/aic100/v2/14nsp/14nsp-quant-resnet50/programqpc.bin --output-dir segments_dir
  • Build a QPC file from config.json:

Example config.json file

{
    "StaticConstants.constants.bin": "StaticConstants.constants.bin",
    "constants.bin": "constants.bin",
    "constants.bin.crc": "constants.bin.crc",
    "constantsdesc.bin": "constantsdesc.bin",
    "metadata.crc": "metadata.crc",
    "network.elf": "network.elf",
    "network.elf.crc": "network.elf.crc",
    "networkdesc.bin": "networkdesc.bin"
}

Example command

sudo /opt/qti-aic/tools/qaic-qpc build --input-dir segments_dir --output-file output.qpc

Create a QPC file:

sudo /opt/qti-aic/tools/qaic-qpc create -o output.qpc -i input_file -i input_dir

Validate a QPC file:

sudo /opt/qti-aic/tools/qaic-qpc validate --qpc /opt/qti-aic/test-data/aic100/v2/14nsp/14nsp-quant-resnet50/programqpc.bin

Build a Wrapper QPC file:

sudo /opt/qti-aic/tools/qaic-qpc build-wrapper --config config.json --output-file programqpc.bin
sudo /opt/qti-aic/tools/qaic-qpc build-wrapper --config config.json --output-file programqpc.bin --allow-override

Argument details

Usage:

qaic-qpc <command> [options]

Commands:

extract       Extract segments from a QPC file
ls            List segments from a QPC file
build         Build a QPC file from config.json
create        Create a QPC file from input files or directory
validate      Validate a QPC file
build-wrapper Build a Wrapper QPC file from config.json

qaic-qpc extract arguments:

Argument

Description

--qpc FILE

Path to the QPC file.

--output-dir DIR

Directory to extract segments to.

-s SEGMENT

(Optional) Segment to include (can be repeated). NOTE : wildcards (*,?) is supported for -s option

qaic-qpc ls arguments:

Argument

Description

--qpc FILE

Path to the QPC file.

qaic-qpc build arguments:

Argument

Description

--input-dir DIR

Directory containing config.json

--output-file FILE

Path to the output QPC file.

qaic-qpc create arguments:

Argument

Description

-i PATH

Input file or directory (can be repeated).

-o FILE

Path to the output QPC file.

qaic-qpc validate arguments:

Argument

Description

--qpc FILE

Path to the QPC file to validate.

qaic-qpc build-wrapper arguments:

Argument

Description

--config FILE

Path to config file.

--output-file FILE

Path to output QPC file.

--allow-override

Allows to overwrite or override existing content when building the wrapper QPC.

--verbose

Enables detailed logging output during execution.