-
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
Support short-circuiting logical expressions #3572
Comments
To implement this in the frontend, I think we can translate |
The solution makes sense to me! Regarding the performance impact, branches are considered harmful in GPU programming :-( Therefore, as the first step, I suggest adding an option like |
The following code snippet,
will give a runtime error due to negative indices. This is because in Taichi, logical expressions are completely evaluated anyway. However, most programming languages are using short-circuiting logical expressions, so this behavior difference may cause confusion to newcomers.
I suggest that Taichi can support short-circuiting logical expressions. To avoid affecting performance of existing code, we can have an option in compiler configurations to decide whether to enable the new behavior.
The text was updated successfully, but these errors were encountered: