I'm Confused about TIR schedule reverse_compute_at

Hi, I read doc about reverse_compute_at(tvm.tir — tvm 0.11.dev0 documentation), it mentions 4 required points:

Reverse-Compute-At. Move a consumer block under the specific loop, and regenerate the loops induced by the block so that the buffer region consumed by the consumer block could cover those regions produced by its producer blocks under the given loop. It requires:

  1. block and loop are under the same scope, loop is not the ancestor of block
  2. The scope block has stage-pipeline property
  3. The subtree of the scope block, where the given block is in, satisfies the compact dataflow condition. i.e. all the blocks in the scope block’s subtree must be either complete block or reduction block
  4. All the producers of the block are under the given loop

I’m confused:

  1. Can block be nested?
  2. What’s the reduction block or complete block?
  3. How to understand the all the producer of the block? confused :crying_cat_face:

Blocks can be nested. But we can only apply schedule on blocks in the same scope (i.e., directly under the same parent block)

Please see the definition at https://github.com/apache/tvm/blob/main/src/tir/schedule/analysis.h#L114

According to the data dependency, we have producer blocks (who write the buffer) and consumers (who read the same buffer)

1 Like

Thanks siyuan :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes: :grinning_face_with_smiling_eyes:

However, have any cases with nested block.

Unfortunately, we don’t have cases with nested blocks now