Fusing injective/elementwise ops makes sense to me. It seems my question wasn’t very clear, so I’ve attached some code below. I’m trying to schedule a conv and pool op consecutively. Atm, I have two separate schedules for each, how do I combine the two schedules into one so that I can pass it into tvm.lower?
# conv
output = topi.nn.conv2d(data, kernel, strides=stride, padding=padding, dilation=1, layout=layout)
output = topi.add(output, bias)
output = topi.nn.relu(output)
s_c = topi.generic.nn.schedule_conv2d_nhwc(output)
# pooling
conv_out = tvm.placeholder(output.shape, dtype=dtype, name='conv_out')
pool_out = topi.nn.pool(conv_out, (2,2), (1,1), (0,0,0,0), 'max')
s_p = topi.generic.nn.schedule_pool(pool_out, layout='NHWC')
I’m currently prototyping for a new HW backend, so I want to be able to schedule and lower an arbitrary set of ops before moving on to running an entire graph. I’m operating under the assumption that importing a graph from ONNX/Mxnet/etc. follows a similar process to the one outlined here; (1) optimize and schedule individual ops like conv and pool + elementwise, (2) combine those optimized ops into a unified schedule for runtime.
This assumption requires that some method be used to traverse individually optimized ops/schedules to combine them into a final, runtime schedule. How would I go about manually creating that final schedule? or are these assumptions incorrect?