Adnios / DNNEmu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Layer-Wise Profiler

This repository is the implementation of our layer-wise profiler. Other code about emulation will be publicly available soon.

Running

Our layer-wise profiler is based on MXNet 1.4.1. You should download MXNet source code and apply the patch(0001-layer-wise-profiler.patch) in this repository to the MXNet source code.

  1. Download the MXNet source.
    git clone https://github.com/apache/incubator-mxnet.git
  2. apply the patch file the MXNet source code.
    cd incubator-mxnet
    git checkout 1.4.1
    git apply 0001-layer-wise-profiler.patch
  3. build and install MXNet follow the Building From Source guide.

Approach

approach

As illustrated in Algorithm 1, our layer-wise profiler uses the operator name (op:name) and layer name (layer id) to record the operator execution. The operator name (e.g., Convolution, Pooling, and FullyConnected) is usually registered with NNVM. One of the biggest improvements brought by NNVM is the operator attribute system, and we can register attributes with any key (e.g., layer name) to any operators. In line 9, the operator attribute system uses attrs:name to store layer name and operator name together. With this feature, we can profile the same operators but in different layers.

Usage

profiler profiler2

Our layer-wise profiler requires no changes to the users' code. You should enable profiler follow the Profiling Guide

  1. View in console
    profiler.set_state('run')
    profiler.set_state('stop')
    print(profiler.dumps())
    print
  2. View in browser
    profiler.dump(finished=False)
    tracing

About