-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[opt] Flatten if(0) and if(1) #1393
Conversation
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.
LGTM.
Codecov Report
@@ Coverage Diff @@
## master #1393 +/- ##
=========================================
Coverage ? 66.72%
=========================================
Files ? 37
Lines ? 5196
Branches ? 933
=========================================
Hits ? 3467
Misses ? 1567
Partials ? 162 Continue to review full report at Codecov.
|
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.
Thanks!
@@ -38,4 +38,4 @@ def func(): | |||
ret[None] = s | |||
|
|||
func() | |||
print(ret[None]) | |||
assert ret[None] == 55 |
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.
Thanks for fixing this ;-)
At least on Metal, this broke taichi/tests/python/test_tuple_assign.py Lines 9 to 12 in b709fb6
I think the
|
Is this because some configs not sync with LLVM ones on Metal? I think ultimately we should:
@ti.kernel
def func():
for i in ti.serial(range(4)):
print(i)
|
I don't think so, because the IR itself already seems buggy. (I don't think CI has test on CUDA, does it?)
+1. This will be a lot less error-prone.
I feel like this is a very non-trivial work. It fundamentally changes how Taichi produces the backend code. In certain cases, maybe Taichi can be made smart enough to figure out how to flatten out a nested loop into the top level. Still, that will likely involve some more IR analysis and transformation works. |
Related issue = #1372
[Click here for the format server]