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

[TVMScript] Add for loop syntax sugar #9620

Merged
merged 13 commits into from
Dec 8, 2021

Conversation

shingjan
Copy link
Contributor

@shingjan shingjan commented Dec 1, 2021

This PR intends to add syntax sugar for For loop scope handler in TIR.
Before this PR:

for i in T.serial(0, 128)
for i in T.parallel(0, 128)
for i in T.vectorized(0, 128)
for i in T.unroll(0, 128)
for i in T.thread_binding(0, 128, thread="threadIdx.x")

After this PR, note that the starting 0 can be omitted:

for i in T.serial(128)
for i in T.parallel(128)
for i in T.vectorized(128)
for i in T.unroll(128)
for i in T.thread_binding(128, thread="threadIdx.x")

cc: @vinx13 @junrushao1994 @Hzfengsy

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.

please also update type stubs and fix the CI error

python/tvm/script/parser.py Outdated Show resolved Hide resolved
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.

Otherwise LGTM

python/tvm/tir/utils.py Outdated Show resolved Hide resolved
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.

LGTM

@junrushao
Copy link
Member

Let's improve the printer in a subsequent PR

@vinx13
Copy link
Member

vinx13 commented Dec 7, 2021

@shingjan the other PR is merged, please rebase this one

@shingjan
Copy link
Contributor Author

shingjan commented Dec 7, 2021

@vinx13 this PR is rebased

@vinx13 vinx13 merged commit c945b24 into apache:main Dec 8, 2021
mikepapadim pushed a commit to mikepapadim/tvm that referenced this pull request Dec 9, 2021
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 12, 2022
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
qsqqsqqsq-intellif pushed a commit to qsqqsqqsq-intellif/tvm that referenced this pull request Apr 29, 2022
* add for loop syntax sugar

* remove prints

* better doc

* finish thread binding

* fix CI

* fix CI

* address comments

* update sstub

* fix CI

* remove failed test

* update stub

* address comments

* add decorator
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.

4 participants