-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[TIR, Schedule] Add schedule primitive PadEinsum #12750
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b2e3ad1
[TIR, Schedule] Add schedule primitive PadEinsum
vinx13 09ed7ab
lint
vinx13 c430110
[TIR] Fix producer indices check in PadEinsum
vinx13 4b940f8
address comments
vinx13 48ac825
simplify lambda expr
vinx13 0becfce
fix
vinx13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -627,6 +627,7 @@ class ScheduleNode : public runtime::Object { | |
BufferIndexType buffer_index_type, | ||
const Array<IntImm>& axis_separators) = 0; | ||
|
||
/******** Schedule: Padding ********/ | ||
/*! | ||
* \brief Decompose a padding block into a block filling const pad values and a block | ||
* writing in-bound values. | ||
|
@@ -636,6 +637,25 @@ class ScheduleNode : public runtime::Object { | |
*/ | ||
virtual BlockRV DecomposePadding(const BlockRV& block_rv, const LoopRV& loop_rv) = 0; | ||
|
||
/*! | ||
* \brief Pad the computation of Einsum. | ||
* \param block_rv The block that matches the Einsum pattern. | ||
* \param padding The padding for each block iter. | ||
* \details This schedule primitives identifies the Einsum pattern in the block body, and find its | ||
* producer blocks. It then pads the computation of the Einsum pattern and its producer blocks. | ||
* The output buffer and the producer buffer is resized according to the padding size. It requires | ||
* the output buffer and the producer buffer to be allocated inside the PrimFunc. | ||
* | ||
* The padding is a list of non-negative integers, each element corresponds to the padding for | ||
* each block iter in the order of block iters. The block and it's producer blocks should have | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: "it's" should be "its", without an apostrphe |
||
* trivial bindings, i.e. each block iter is bound to a single loop variable. After padding, the | ||
* block iter extent and the corresponding outer loop is extended by the padding size. | ||
* | ||
* The size of the producer buffers are infered from the padding size of the Einsum computation. | ||
* The producer buffers are padded by the initial value of the corresponding reduction. | ||
*/ | ||
virtual void PadEinsum(const BlockRV& block_rv, const Array<Integer>& padding) = 0; | ||
|
||
/******** Schedule: Misc ********/ | ||
/*! \brief A no-op that marks the start of postprocessing phase of scheduling */ | ||
virtual void EnterPostproc() = 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the padding can only be applied to the end of an axis/iterator, and cannot be applied to the beginning. Could we specify two arrays of padding, one for the lower end each block iter and one for the upper end?