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] Stop broadcasting scalar cond in select statements #7344

Merged
merged 8 commits into from
Feb 15, 2023

Conversation

dream189free
Copy link
Contributor

Issue: #7240

Brief Summary

  1. Stop broadcasting cond when it is a scalar in a select statement.
  2. Since config.real_matrix_scalarize is currently set to True, we need to scalarize the select. I added another code path to do this, which seems ugly.
  3. We can see the expected behavior when config.real_matrix_scalarize is unset.

@CLAassistant
Copy link

CLAassistant commented Feb 13, 2023

CLA assistant check
All committers have signed the CLA.

@netlify
Copy link

netlify bot commented Feb 13, 2023

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit fda9152
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/63ec43a953b9520007ee279b
😎 Deploy Preview https://deploy-preview-7344--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.

@dream189free dream189free changed the title [lang] Stop broadcasting scalar cond in select statements [lang] Stop broadcasting scalar cond in select statements Feb 13, 2023
Copy link
Contributor

@jim19930609 jim19930609 left a comment

Choose a reason for hiding this comment

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

Good job! Btw you can add a C++ test to:

  1. create a TernaryOpExpression at Frontend IR level
  2. make a function call to TernaryOpExpression::type_check(...)
  3. Verify that the cond wasn't broadcast-ed anymore

you can refer to: tests/cpp/ir/frontend_type_inference_test.cpp

Copy link
Contributor

@jim19930609 jim19930609 left a comment

Choose a reason for hiding this comment

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

Hmmmm, looks like it's poluted by some other branches?

@dream189free dream189free merged commit 4b59087 into taichi-dev:master Feb 15, 2023
quadpixels pushed a commit to quadpixels/taichi that referenced this pull request May 13, 2023
…#7344)

Issue: taichi-dev#7240 

### Brief Summary
1. Stop broadcasting `cond` when it is a scalar in a `select` statement.
2. Since `config.real_matrix_scalarize` is currently set to `True`, we
need to scalarize the `select`. I added another code path to do this,
which seems ugly.
3. We can see the expected behavior when `config.real_matrix_scalarize`
is unset.
4. Add python and c++ unit test for select stmts.

---------

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.

3 participants