SHL 2.2.x
|
English | 简体中文
SHL(Structure of Heterogeneous Library, Chinese name: ShiHulan) is a high-performance Heterogeneous computing library provided by T-HEAD. The interface of SHL uses T-HEAD neural network library API for XuanTie CPU platform: CSI-NN2, and provides a series of optimized binary libraries.
Features for SHL:
In principle, SHL only provides the reference implementation of XuanTie CPU platform, and the optimization of each NPU target platform is completed by the vendor of the specific platform.
SHL released packages are published in PyPi, can install with hhb.
binary libary is at /usr/local/lib/python3.6/dist-packages/tvm/install_nn2/
Here is one example to build C906 library.
We need to install T-HEAD RISC-V GCC 2.6, which can get from T-HEAD OCC, download, decompress, and set path environment.
Download source code
compile c906
install c906
Here is one example for XuanTie C906 to run mobilenetv1. It shows how to call SHL API to inference the whole model.
compile command:
c906_mobilenetv1_f16.elf will be generated after completion. After copying it to the development board with C906 CPU [such as D1], execute:
NOTE: Original mobilenetv1's every conv2d has one BN(batch norm), but the example assumes BN had been fused into conv2d。About how to use deployment tools to fuse BN, and emit right weight float16 value, can reference HHB.
SHL refers to the following projects: