User interface pipeline for building tools
Lynazhang opened this issue · comments
The building tools consists of two key component: the fusion rule detection and adaptive data sampler:
builder
/configs # this config folders contain: backends config file, kernel init sampling file, and a base config file.
/rule_tester
/adaptive_sampler
Now we consider that user has a new hardware platform (inference framework+device), and he wants to use nn-Meter to build latency predictor, user can follow the steps:
- create a project folder (named by user's platform)
- copy default backend config from nn_meter/builder
- user edit the config files, test the device connection
- run
rule_tester
to get all the fused operators (get_testcases
) - prepare test models, run
get_fusionrule
to get kernels - run
adaptive_sample
to sample data and build latency predictor
a. check with current kernel configs, if the target kernels are new, please also add the tf kernel code
b. edit the initial sampling count for the kernels, it will sample from a prior distribution
c. sample from the prior distribution, save the sampled kernel models
d. measure the latency on the device
e. split data into train/test, choose the regression model, build the latency prediction (current implementation:kernel_predictor
)
f. evaluate the regression model, return the rmse, rmspe, label the data points with largest prediction error
g. random fine-grained data sampling for large-error-data-points
h. repeat from step d, until the rmse, rmspe in f meet user's requirements