Skip to content

Conversation

@vinx13
Copy link
Member

@vinx13 vinx13 commented Jan 7, 2022

This PR added two schedule primitives, blockize, and tensorize to TensorIR.

cc @junrushao1994 @spectrometerHBH @Hzfengsy @masahi @comaniac @tqchen @csullivan

Co-authored-by: Siyuan Feng [email protected]
Co-authored-by: Bohan Hou [email protected]
Co-authored-by: Hongyi Jin [email protected]
Co-authored-by: Ruihang Lai [email protected]
Co-authored-by: Junru Shao [email protected]
Co-authored-by: Xiyou Zhou [email protected]

Comment on lines 204 to 205
self_->block_info[scope_root] = BlockInfo(BlockScope(child_block_srefs));
BlockInfo& info = self_->block_info[scope_root];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? I suppose they are logically equivalent and the original one saves one lookup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emplace will not overwrite the old entry if the key exists. This function may be called in UpdateScopeBlockInfo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see - that makes sense to me! Then to save one look-up, let's do

Suggested change
self_->block_info[scope_root] = BlockInfo(BlockScope(child_block_srefs));
BlockInfo& info = self_->block_info[scope_root];
BlockInfo& info = self_->block_info[scope_root] = BlockInfo(BlockScope(child_block_srefs));

bool CompareRange(const Range& lhs, const Range& rhs);
bool CompareType(const DataType& lhs, const DataType& rhs);

protected:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why protected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there might be some use cases to subclass this class, like auto tensorization

if (n->type_index() != other->type_index()) return false;
bool equal = StmtComparator::VisitStmt(n, other);
if (!equal && assert_mode_)
LOG(FATAL) << "Stmts are not matching between:\n" << n << "\nand\n" << other;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use ScheduleError here? Since it has a better error renderer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it's non-trivial for now to do so, let's leave it as future improvement

Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like all my comments (a lot) are addressed. Thanks for the effort @vinx13!

@github-actions github-actions bot requested a review from junrushao January 25, 2022 01:46
@Hzfengsy Hzfengsy merged commit 5e7438f into apache:main Jan 26, 2022
sunggg pushed a commit to sunggg/tvm that referenced this pull request Jan 29, 2022
* WIP

* WIP

* WIP

* test cases

* add examples

* lint

* Amend co-authors information

Co-authored-by: Siyuan Feng <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Xiyou Zhou <[email protected]>

* WIP

* address comments and changed tensorized comparator

* update

* nit

* fix example

* lint

* lint

* lint

* remove unused

* trigger ci

* clang-format

* fix

* rebase

Co-authored-by: Siyuan Feng <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Xiyou Zhou <[email protected]>
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
* WIP

* WIP

* WIP

* test cases

* add examples

* lint

* Amend co-authors information

Co-authored-by: Siyuan Feng <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Xiyou Zhou <[email protected]>

* WIP

* address comments and changed tensorized comparator

* update

* nit

* fix example

* lint

* lint

* lint

* remove unused

* trigger ci

* clang-format

* fix

* rebase

Co-authored-by: Siyuan Feng <[email protected]>
Co-authored-by: Bohan Hou <[email protected]>
Co-authored-by: Hongyi Jin <[email protected]>
Co-authored-by: Ruihang Lai <[email protected]>
Co-authored-by: Junru Shao <[email protected]>
Co-authored-by: Xiyou Zhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants