[Hybrid Script] Is there possibility to support most schedule and keep results right in hybrid script?


For the supported schedule reorder and fuse, is it possible to keep the results right automatically like tvm.compute? And is it possible to support other schedule such as compute_at? If not, what’s the restriction ?3q @were


I believe mostly they are semantically correct.

Say “mostly”, because you need to know something about the implementation details of how schedule is applied on the IR.

You can refer https://github.com/dmlc/tvm/blob/45878ff2ab111b55448cf62e34bc58eb3e36b671/include/tvm/expr.h#L277

There several kinds of loops:

  1. DataPar: You can freely schedule them with any scheduling premitives.
  2. CommReduce: This is generated by tvm.reduce or tvm.sum, which operates a reduction.
  3. Ordered: something like sum[i] = sum[i-1] + k;
  4. Opaque: IIRC, after applying xo, xi = split(x, 4), x becomes opaque. You can no longer play anything on it.
  5. Unrolled/Vectorized/Parallelized/Tensorized: loop levels manipulated by the corresponding premitive.

For now, I did not write a pass to differentiate 1/2/3. I regard them as all kind 1, which is true in most cases I believe.