-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[TVMScript] Use tir::Evaluate if expression is in statement context #13396
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3458,6 +3458,15 @@ def func() -> None: | |
| return func | ||
|
|
||
|
|
||
| def implicit_evaluate(): | ||
| @T.prim_func | ||
| def func(A: T.Buffer[1, "int32"]): | ||
| T.evaluate(T.assume(A[0] == 5)) | ||
| A[0] = 10 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curious what's this line for?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly because
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see. Thanks for the clarification! |
||
|
|
||
| return func | ||
|
|
||
|
|
||
| ir_generator = tvm.testing.parameter( | ||
| opt_gemm_normalize, | ||
| opt_gemm_lower, | ||
|
|
@@ -3509,6 +3518,7 @@ def func() -> None: | |
| bool_primitive, | ||
| bool_cast, | ||
| return_none, | ||
| implicit_evaluate, | ||
| ) | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey i was wondering if we want to explicitly print
T.evaluate(0)vs0? The former one might look a bit clearer from my perspectiveThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going back and forth on it, and I like the idea of printing
T.evaluate()except in the case of CallNode. The more aggressive sugaring would be to rendertir::Evaluate(0)aspass, which would be even clearer to read from a casual Python reader.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea!