NVDLA简介
nvdia深度学习加速器(NVDLA)是一种免费开放式架构,具有可扩展性,高度可配置性,旨在简化集成和可移植性。NVDLA软件生态系统包括一个设备上的软件堆栈(开源版本的一部分),一个完整的培训基础架构,用于构建包含深度学习的新模型,以及将现有模型转换为可在设备上使用的形式的解析器软件。可以提供其自己的硬件平台以及软件内核:
NVDLA可以加速神经网络推理工作,可分两步完成
- 针对DLA硬件优化训练有素的神经网络,并将图形转换为DLA HW指令。转换后的图形将保存到称为可加载的平面缓冲区文件中。使用NVDLA编译器可以实现此目的,并且可以在主机系统上脱机执行。
- 使用步骤1中的可加载程序在DLA上运行推理作业。这是使用NVDLA运行时实现的,并在目标系统上执行
NVDLA Compiler
NVDLA编译器用于为DLA HW体系结构优化神经网络,并创建HW指令列表以在DLA上运行推理。NVDLA编译器可以从源代码构建,也可以直接使用预编译的二进制文件
root@6b9d78f7dd:# ./nvdla_compiler -h
Usage: ./nvdla_compiler [-options] --prototxt <prototxt_file> --caffemodel <caffemodel_file>
where options include:
-h print this help message
-o <outputpath> outputs wisdom files in 'outputpath' directory
--profile <basic|default|performance|fast-math> computation profile (default: fast-math)
--cprecision <fp16|int8> compute precision (default: fp16)
--configtarget <opendla-full|opendla-large|opendla-small> target platform (default: nv_full)
--calibtable <int8 calib file> calibration table for INT8 networks (default: 0.00787)
--quantizationMode <per-kernel|per-filter> quantization mode for INT8 (default: per-kernel)
--batch batch size (default: 1)
--informat <ncxhwx|nchw|nhwc> input data format (default: nhwc)
转换example(以resnet50 nv_full int8 为例)
./nvdla_compiler --prototxt ResNet-50-deploy.prototxt --caffemodel ResNet-50-model.caffemodel -o . --profile fast-math --cprecision int8 --configtarget nv_full --calibtable resnet50.json --quantizationMode per-filter --batch 1 --informat nhwc
输出
一旦编译成功,它将在使用-o参数指定的输出目录中生成.nvdla文件。例如,在上述情况下,它将在curren目录中生成fast-math.nvdla
如果需要自行编译nvdla_compiler
cd umd export TOP={sw-repo-root}/umd make compiler Note : 使用sdk中默认的libprotobuf.a可能链接会报错,这个需要根据自己的环境重新编译一下protobuf,命令如下 ./configure --enable-shared make make check sudo make install