How to create a generic compute and override per target without autotvm?


I am trying to call cblas libraries when “cblas” is specified in the target libs and the target is x86. This needs to happen in two places: dense and batch_matmul.

Dense is straightforward because x86 already has an overridden compute and schedule. However, batch_matmul only has an overridden schedule. All computes call the same compute function. Further, batch_matmul doesn’t support autotvm tuning. How can I make a generic compute call and override it per target?

Should I use the same methodology as the generic schedules in topi/python/topi/generic/ Or should I still use the @autotvm.register_topi_compute decorator?


Should this be done using the same methodology as the generic dense compute in Using a new FTVMBatchMatMulBuilder?


I found that this can be done by using a couple of decorators, and @<function_name>.register