Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TensorIR][M2a] Decompose-Reduction #9041

Merged
merged 16 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comment
  • Loading branch information
spectrometerHBH committed Oct 2, 2021
commit 9afccb286459500436095bf11a0a343ee6b7b1d8
9 changes: 7 additions & 2 deletions include/tvm/tir/schedule/schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,13 @@ class ScheduleNode : public runtime::Object {
virtual void ReverseComputeInline(const BlockRV& block) = 0;
/******** Schedule: Reduction ********/
/*!
* \brief Decompose a reduction block into init block and update block, where the newly generated
init block will be before the specified loop. It requires that
* \brief Decompose a reduction block into two separate blocks.
* a) The init block, which is translated from the init statement of the reduction block;
* b) The update block, which is the original block without init statement.
*
* The init block is inserted right before the given loop.
*
* The schedule primitive requires:
1) The input block is a reduction block.
2) The input loop is the ancestor of the block.
3) The input loop is not lower than all the loops related to reduce block var.
Expand Down
11 changes: 9 additions & 2 deletions python/tvm/tir/schedule/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,16 @@ def after_inline(a: T.handle, c: T.handle) -> None:
########## Schedule: Reduction ##########

def decompose_reduction(self, block: BlockRV, loop: LoopRV) -> BlockRV:
"""Decompose a reduction block into init block and update block, where the newly generated
init block will be before the specified loop. It requires that
"""Decompose a reduction block into two separate blocks.

a) The init block, which is translated from the init statement of the reduction block;

b) The update block, which is the original block without init statement.

The init block is inserted right before the given loop.

The schedule primitive requires:

1) The input block is a reduction block.

2) The input loop is the ancestor of the block.
Expand Down