[Bugfix][TIR] Handle AttrStmt of upcoming tir.Var in ConvertSSA#16682
Merged
tqchen merged 1 commit intoapache:mainfrom Mar 9, 2024
Merged
[Bugfix][TIR] Handle AttrStmt of upcoming tir.Var in ConvertSSA#16682tqchen merged 1 commit intoapache:mainfrom
tqchen merged 1 commit intoapache:mainfrom
Conversation
In some cases, an `AttrStmt` may legally refer to a TIR variable that hasn't yet been defined. For example, the `"pragma_parallel_launch_point"` attribute, which annotates a variable that is about to occur in a ForNode. Prior to this commit, `ConvertSSA` treated the `AttrStmt` as the usage of a variable, followed by a nested definition to be de-duplicated. This resulted in the output `AttrStmt` containing a reference to an undefined variable. This commit updates `ConvertSSA` to handle this case. If an `AttrStmt` refers to a not-yet-defined variable, the body is visited before marking it as defined. This implementation may be simplified in the future by moving "pragma_parallel_launch_point" to be an annotation on the `ForNode`, rather than an `AttrStmt`.
794e51c to
f480fa4
Compare
Contributor
Author
|
@slyubomirsky This should unblock #16682, as it resolves the issue found in |
slyubomirsky
approved these changes
Mar 6, 2024
Contributor
slyubomirsky
left a comment
There was a problem hiding this comment.
Thank you for the change. Would this also work for attributes that do act as points of definition?
Contributor
Author
It should, yes. This behavior is tested in |
Lunderberg
added a commit
to Lunderberg/tvm
that referenced
this pull request
Mar 12, 2024
…he#16682) In some cases, an `AttrStmt` may legally refer to a TIR variable that hasn't yet been defined. For example, the `"pragma_parallel_launch_point"` attribute, which annotates a variable that is about to occur in a ForNode. Prior to this commit, `ConvertSSA` treated the `AttrStmt` as the usage of a variable, followed by a nested definition to be de-duplicated. This resulted in the output `AttrStmt` containing a reference to an undefined variable. This commit updates `ConvertSSA` to handle this case. If an `AttrStmt` refers to a not-yet-defined variable, the body is visited before marking it as defined. This implementation may be simplified in the future by moving "pragma_parallel_launch_point" to be an annotation on the `ForNode`, rather than an `AttrStmt`.
thaisacs
pushed a commit
to thaisacs/tvm
that referenced
this pull request
Apr 3, 2024
…he#16682) In some cases, an `AttrStmt` may legally refer to a TIR variable that hasn't yet been defined. For example, the `"pragma_parallel_launch_point"` attribute, which annotates a variable that is about to occur in a ForNode. Prior to this commit, `ConvertSSA` treated the `AttrStmt` as the usage of a variable, followed by a nested definition to be de-duplicated. This resulted in the output `AttrStmt` containing a reference to an undefined variable. This commit updates `ConvertSSA` to handle this case. If an `AttrStmt` refers to a not-yet-defined variable, the body is visited before marking it as defined. This implementation may be simplified in the future by moving "pragma_parallel_launch_point" to be an annotation on the `ForNode`, rather than an `AttrStmt`.
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.
In some cases, an
AttrStmtmay legally refer to a TIR variable that hasn't yet been defined. For example, the"pragma_parallel_launch_point"attribute, which annotates a variable that is about to occur in a ForNode. Prior to this commit,ConvertSSAtreated theAttrStmtas the usage of a variable, followed by a nested definition to be de-duplicated. This resulted in the outputAttrStmtcontaining a reference to an undefined variable.This commit updates
ConvertSSAto handle this case. If anAttrStmtrefers to a not-yet-defined variable, the body is visited before marking it as defined.This implementation may be simplified in the future by moving "pragma_parallel_launch_point" to be an annotation on the
ForNode, rather than anAttrStmt.