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

Adding annotations for tir.allocate #9168

Merged
merged 2 commits into from
Oct 7, 2021

Conversation

manupak
Copy link
Contributor

@manupak manupak commented Sep 30, 2021

This commit is adding annotations for tir.allocate node to be used as hints for future transformations.

Please refer to the discussion : apache/tvm-rfcs#23

cc: @tqchen @junrushao1994 @areusch

python/tvm/tir/stmt.py Outdated Show resolved Hide resolved
@manupak manupak force-pushed the tir_allocate_annotatations branch from 9081089 to 506c2f2 Compare October 1, 2021 11:13
Copy link
Member

@Mousius Mousius left a comment

Choose a reason for hiding this comment

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

Makes sense to me 😸

@manupak manupak changed the title Adding annotation for tir.allocate Adding annotations for tir.allocate Oct 2, 2021
@manupak manupak force-pushed the tir_allocate_annotatations branch from 8e4a870 to f4f916d Compare October 4, 2021 14:36
@areusch
Copy link
Contributor

areusch commented Oct 4, 2021

please tag the tracking issue @manupa-arm

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

deferring to @vinx13 for approval but lgtm

Copy link
Member

@vinx13 vinx13 left a comment

Choose a reason for hiding this comment

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

Some minor comments, otherwise LGTM

include/tvm/tir/stmt.h Outdated Show resolved Hide resolved
include/tvm/tir/stmt.h Outdated Show resolved Hide resolved
This commit is adding annotations for tir.allocate
node to be used as hints for future transformations.

Change-Id: I02a3a875c38c3edd449385da5b741ef4958bb47f
@manupak manupak force-pushed the tir_allocate_annotatations branch from f4f916d to 4971d09 Compare October 5, 2021 10:19
@manupak
Copy link
Contributor Author

manupak commented Oct 5, 2021

Thanks @vinx13 .
I have addressed them now, PTAL.

Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

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

Please also update the Script syntax and add a testcase.

The related codes are here:

class Allocate(WithScopeHandler):
"""With scope handler T.allocate(extents, dtype, scope, condition)"""
def __init__(self):
def allocate(extents, dtype, scope, condition=True, span=None):
condition = tvm.runtime.convert(condition)
scope = tvm.runtime.convert(scope)
return tvm.tir.Allocate(
self.buffer_var, dtype, extents, condition, self.body, span=span
)

@Hzfengsy
Copy link
Member

Hzfengsy commented Oct 5, 2021

Please also update the three printers:

.set_dispatch<AllocateNode>([](const ObjectRef& node, ReprPrinter* p) {

Doc TVMScriptPrinter::VisitStmt_(const AllocateNode* op) {

Doc TIRTextPrinter::VisitStmt_(const AllocateNode* op) {

@manupak manupak requested a review from zhiics as a code owner October 6, 2021 09:54
@manupak
Copy link
Contributor Author

manupak commented Oct 6, 2021

@Hzfengsy thanks for the review!

I think I've done the necessary changes now. PTAL.

Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @manupa-arm

@manupak manupak force-pushed the tir_allocate_annotatations branch from 00d2218 to 31d8db9 Compare October 6, 2021 17:58
@manupak manupak force-pushed the tir_allocate_annotatations branch from 31d8db9 to 5ff4f7f Compare October 6, 2021 22:28
* adding tvmscript support
* adding tir text printing support

Change-Id: Id0b6725b2e79c23f6b8ff192772f1ea4125a27c2
@manupak manupak force-pushed the tir_allocate_annotatations branch from 5ff4f7f to 94b7435 Compare October 7, 2021 05:35
@manupak
Copy link
Contributor Author

manupak commented Oct 7, 2021

@vinx13 @Hzfengsy merge?

@Hzfengsy Hzfengsy merged commit 2dae303 into apache:main Oct 7, 2021
@Hzfengsy
Copy link
Member

Hzfengsy commented Oct 7, 2021

Sorry for the late response. Thanks @manupa-arm.

ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* Adding annotation for tir.allocate

This commit is adding annotations for tir.allocate
node to be used as hints for future transformations.

Change-Id: I02a3a875c38c3edd449385da5b741ef4958bb47f

* Adding annotation for tir.allocate

* adding tvmscript support
* adding tir text printing support

Change-Id: Id0b6725b2e79c23f6b8ff192772f1ea4125a27c2
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* Adding annotation for tir.allocate

This commit is adding annotations for tir.allocate
node to be used as hints for future transformations.

Change-Id: I02a3a875c38c3edd449385da5b741ef4958bb47f

* Adding annotation for tir.allocate

* adding tvmscript support
* adding tir text printing support

Change-Id: Id0b6725b2e79c23f6b8ff192772f1ea4125a27c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants