[ Auto TVM ] how to add add_lower_pass in tvm.task config_space?

hello. i’m freash user of TVM

TVM can insert custom lower pass by using tvm.build_config( add_lower_pass = blah balh ) before build specific target devcie module.

as menthioned in https://docs.tvm.ai/tutorials/dev/low_level_custom_pass.html

and TVM support autotvm to tune each layer by using autotvm.task.extract_from_program function.

Below is the code I wrote.

Briefly, the ConvTuner accepts the tasks and tune each conv2d layer.

in ConvTuner function, tsk has a config space as shown in below picture.

i want to insert my custom add_lower_pass and before build network.

for example…

What I want is that each conv2d layer wants to be optimized at build time through a custom ir pass I created.

Is there an example or way to do this?

Do you mean adding custom pass during tuning? You can set build_kwargs in autotvm builder, e.g https://github.com/apache/incubator-tvm/blob/dc5f70adbfad96ea382e96f1dc7313c06c74f9d0/python/tvm/autotvm/measure/measure_methods.py#L358

1 Like

wow Thanks! i will try it.

Thank you!