Schedule of a fused operator in tvm

Hi,

I would like to know the source file where the schedule of a fused operator works in tvm? and how it merges the schedule of individual ops to a fused op?

thank you

Each schedule is responsible for fusing “post ops” if any. Here is one example https://github.com/apache/tvm/blob/52d6b59a39f503fe382b4d7cbac4b02f9e44aae0/python/tvm/topi/generic/conv2d.py#L238-L257

Thank you @masahi

As two complex ops (i.e > kBroadcast) can’t be fused, how one complex op in a fusion group handles the schedule of remaining ops in that group?

That’s what the link above does. C there is the output of conv2d, while O is the output of a fused operation, for example conv2d + bias + relu. The highlight code basically says: “If conv2d (C) is not the output of the whole operation (O), fuse the post ops”. In particular, compute_at at https://github.com/apache/tvm/blob/52d6b59a39f503fe382b4d7cbac4b02f9e44aae0/python/tvm/topi/generic/conv2d.py#L255 places the computation of C (conv2d) under the loop nest of O (fused op).

Thank you @masahi, it helped me a lot.

Is there any way to print post dominator tree with Op names in fusion?

1 Like