[TVMScript] Sugar T.env_thread + T.launch_thread#14217
Merged
junrushao merged 1 commit intoapache:mainfrom Mar 7, 2023
Merged
Conversation
Collaborator
Member
Author
659fd9f to
bbc39df
Compare
spectrometerHBH
approved these changes
Mar 7, 2023
Member
|
Could you please add a test case for it? |
Member
Author
|
@Hzfengsy Existing roundtripping tests should suffice already. Do you prefer if I added a new one? |
Member
It would be great if we can have another explicit one :) |
bbc39df to
2cb8a76
Compare
Member
Author
|
Got it. @Hzfengsy Just added a new testcase |
This PR introduces a syntactic sugar that combines T.env_thread and
T.launch_thread.
Previously, an AttrStmt that specifies thread extent or virtual thread
is required to be written in two steps:
```python
bx = T.env_thread("blockIdx.x") // creates an IterVar
with T.launch_thread(bx, 128): // specify the iter domain
...
```
With this PR, now this behavior can be merged in a single line:
```python
with T.launch_thread("blockIdx.x", 128) as bx:
...
```
2cb8a76 to
7ca1009
Compare
Hzfengsy
approved these changes
Mar 7, 2023
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces a syntactic sugar that combines T.env_thread and T.launch_thread.
Previously, an AttrStmt that specifies thread extent or virtual thread is required to be written in two steps:
With this PR, now this behavior can be merged in a single line: