Skip to content
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

[Lang] [ir] Move short-circuit boolean logic into AST-to-IR passes #4580

Merged
merged 6 commits into from
Apr 18, 2022

Conversation

re-xyr
Copy link
Contributor

@re-xyr re-xyr commented Mar 19, 2022

Related issue = #3572, #3635, Fixes #4804

@netlify
Copy link

netlify bot commented Mar 19, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit e711710
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/625be084f76aed0008a3ff79
😎 Deploy Preview https://deploy-preview-4580--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@re-xyr re-xyr force-pushed the frontend_bool_op branch from 2e1cc4e to eafa0b1 Compare March 19, 2022 08:34
@re-xyr re-xyr force-pushed the frontend_bool_op branch from eafa0b1 to 7e691bc Compare March 19, 2022 09:44
@re-xyr
Copy link
Contributor Author

re-xyr commented Mar 19, 2022

Two tests were failing because I used the new logical_and in ASTTransformer.build_Compare: test_element_wise and test_bit_array_vectorization. Some thoughts:

  • How does the python Matrix handle comparations (or other operators)? I could't find relevant code in ops.py, matrix.py or ast_transformer.py.
  • The bit vectorization pass seems very fragile, as seemingly irrelevant changes will screw it up to the point of the compiler panicking (this is not the first time, see [Lang] [ir] Add general operation abstraction and remove InternalFuncCallExpression #4180). Maybe we need to revise this pass at some point to make it more robust?

@re-xyr
Copy link
Contributor Author

re-xyr commented Apr 5, 2022

I have tested locally with build_Compare using logical_and and short_circuit_operators on by default. Turns out all but one of the problems are caused by this one fact: Taichi's logical true is -1 while Python's is 1. Prepare for a massive test rewrite...

@re-xyr
Copy link
Contributor Author

re-xyr commented Apr 17, 2022

@strongoier I think this is good to merge for now.

@FantasyVR FantasyVR requested review from lin-hitonami, strongoier and PGZXB and removed request for lin-hitonami and strongoier April 18, 2022 01:38
Copy link
Contributor

@strongoier strongoier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@strongoier strongoier merged commit c171215 into taichi-dev:master Apr 18, 2022
k-ye pushed a commit to k-ye/taichi that referenced this pull request May 5, 2022
…aichi-dev#4580)

* [Lang] [ir] Move short-circuit boolean logic into AST-to-IR passes

* [Lang] Enable short circuit bool operators by default

* [ir] Remove true_mask and false_mask in IfStmt & mask_var in Block

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove IfStmt::true_mask, false_mask
2 participants