Background
Currently AutoTVM uses random input data to measure the generated functions. However, there are circumstances where we want fixed input. For example, when we are tuning a sparse operator (current sparse operators in TOPI are not tunable), fixed indices are required to ensure continued execution and stable access pattern, or we will be failing most cases and get non-progressing tuning results.
Solutions in similar occasions
In AutoScheduler we have the argument task_inputs on SearchTask
to specify fixed input.
In AutoTVM, prior to PR-7250 we have the field RPCRunner.ref_input
to do the job. Post to PR-7250 we can do monkey-patching on RPCSession.get_function
to use an alternative of tvm.contrib.random.random_fill
.
Design discussion
We have two options for this interface,
- A field to specify a fixed input data;
- A field to specify an alternative input generator (proposed by areusch).
For sparse operators, fixed input data should be preferred; or we may run into problems of measuring different kernels for different cases. Still, there may be some operators that can benefit from varied input. Or else we can make it both, wrapping fixed input with a function or branching on its callable-ness.