Awesome
HALO
Heterogeneity-Aware Lowering and Optimization (HALO) is a heterogeneous computing acceleration platform based on the compiler technology. It exploits the heterogeneous computing power targeting the deep learning field through an abstract, extendable interface called Open Deep Learning API (ODLA). HALO provides a unified Ahead-Of-Time compilation solution, auto tailored for cloud, edge, and IoT scenarios.
HALO supports multiple compilation modes. Under the ahead-of-time (AOT) compilation mode, HALO compiles an AI model into the C/C++ code written in the ODLA APIs. The compiled model can be run on any supported platform with the corresponding ODLA runtime liibrary. Plus, HALO is able to compile both host and heterogeneous device code simultaneously. The picture below shows the overall compilation flow:
<p align="center"> <img src="docs/halo_odla.png" width="90%"> </p>HALO has supported the compilation of models from the following frameworks:
- Caffe
- ONNX
- TensorFlow
- TFLite
More frameworks will be supported soon.
HALO supports Alibaba's first AI-inference chip: Hanguang-800 NPU via its HgAI SDK. Hanguang-800 NPU is designed by T-Head Semiconductor Co., Ltd. (also known as PingTouGe), a business entity of Alibaba Group.
<a href="https://www.t-head.cn"> <img src="./docs/t_head.png" width="30%"></a> <a href="https://www.t-head.cn/product/npu?spm=a2ouz.12987052.0.0.7d1a6245rNL0T1"><img src="./docs/hanguang800.png" width="10%"></a>
A broad ODLA ecosystem is supported via the ODLA runtime library set targeting various heterogeneous accelerators/runtimes:
And we welcome new accelerator platforms to join in the ODLA community.
ODLA API Reference can be found here and detailed programming guide be coming soon...
Partners
We appreciate the support of ODLA runtimes from the following partners:
<!-- alphabetical order of partners --> <p align="left" width=100%> <a href=http://www.cambricon.com> <img src="./docs/partners/cambricon.png" width=20% border=0 align="center"></a> <img src="./docs/partners/padding.png" width=10%> <a href=https://www.graphcore.ai> <img src="./docs/partners/graphcore.png" width=24% align="center" border=0></a> <img src="./docs/partners/padding.png" width=10%> <a href=https://www.intel.com> <img src="./docs/partners/intel.png" align="center" width=16%></a> </p> <p align="left"> <a href=https://www.nvidia.com><img src="./docs/partners/nvidia.png" align="center" border=0 width=12%></a> <img src="./docs/partners/padding.png" width=18%> <a href=https://www.qualcomm.com/products/cloud-artificial-intelligence> <img title="Qualcomm Cloud AI 100" src="./docs/partners/qualcomm.png" align="center" border=0 width=22%> </a> <img src="./docs/partners/padding.png" width=8%> </p>How to Use HALO
To build HALO, please follow the instructions here (查看中文).
The workflow of deploying models using HALO includes:
- Use HALO to compile the model file(s) into an ODLA-based C/C++ source file.
- Use a C/C++ compiler to compile the generated C/C++ file into an object file.
- Link the object file, the weight binary, and specific ODLA runtime library together.
A Simple Example
Let's start with a simple example of MNIST based on TensorFlow Tutorial. The diagram below shows the overall workflow:
<p align="center"> <img src="docs/mnist.png" width="100%"> </p>Brief explanations:
HALO generates 3 files:
- mnist.h : the header file to be used by application.
- mnist.cc : the ODLA C++ file that represents the model.
- mnist.bin : the weights in ELF format.
To application, the inference is simply viewed as a function call mnist()
.
Note that, for portability purpose, HALO always exports functions in the C convention even though the output file model.cc is in the C++ format.
More detailed explanations can be found here. Example code can be found here
Please refer to HALO options list for all command line options.
More Examples
- an end-to-end example of deploying YOLOv3 model
- using generated code in Python
- a list of demos of various models
Contributing
We're always looking for help to improve HALO. See the Contributing Guide for more details. Thank you!
Resources
License
HALO is licensed under the Apache 2.0 License