Skip to content
Snippets Groups Projects
getting-started.rst 10.75 KiB

Getting Started

This tutorial explains how to build and use HPVM.

  • Before you proceed, check out the :doc:`build instruction for HPVM <build-hpvm>`.

To demonstrate the workflow, we will generate a DNN model, VGG16 (for CIFAR10 dataset), into HPVM code, compile it with HPVM, perform autotuning on the compiled binary to find approximation choices (configurations), and profile the selected configurations to get real performance on device. The result will be a figure showing the accuracy-performance tradeoff of VGG16 over the (pre-defined) approximations and the configurations in a few formats.

  • Please check test/dnn_benchmarks/model_params/ exists and contains vgg16_cifar10/ and pytorch/vgg16_cifar10.pth.tar, which may not be the case if you opted out of model parameter download in the installer. In that case, you may run the installer again to download the model parameters. It will not rebuild everything from scratch.

Generating and Compiling a DNN Model

Below we will use torch2hpvm, the PyTorch API as an example. This package lives at projects/torch2hpvm and should have been installed by the installer. The Keras frontend serves a similar purpose, and its usage can be found in the :doc:`documentation </components/keras-frontend>`.

Note that below we'll be working under directory test/dnn_benchmarks, for easier access to test/dnn_benchmarks/model_params/. You can also symlink it to other locations -- don't move it: it's used in test cases -- and adjust the paths below accordingly.

First, prepare 2 datasets for autotuning and testing for VGG16. These datasets are provided as model_params/vgg16_cifar10/{tune|test}_{input|labels}.bin, where tune and test prefixes signify tuning and testing set.