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

[opt] Automatically identify allocas to scalarize #7055

Merged
merged 3 commits into from
Jan 5, 2023

Conversation

strongoier
Copy link
Contributor

Issue: #2590

Brief Summary

Previously ScalarizePointers (which is for allocas) takes place only when dynamic_index=False. In this PR, we automatically identify those allocas only indexed with constants and get them scalarized, and let the remaining allocas go through the code path for dynamic indexing. In this way, we make old user programs behave the same regardless of the dynamic_index option, and provide dynamic indexing support for new user programs at the same time.

@strongoier strongoier added the full-ci Run complete set of CI tests label Jan 5, 2023
@strongoier strongoier added this to the v1.4.0 milestone Jan 5, 2023
@netlify
Copy link

netlify bot commented Jan 5, 2023

Deploy Preview for docsite-preview ready!

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

Copy link
Contributor

@lin-hitonami lin-hitonami left a comment

Choose a reason for hiding this comment

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

Should this pass be placed after a simplify pass? IIUC the offset may be optimized to a constant after constant folding.

taichi/transforms/scalarize.cpp Outdated Show resolved Hide resolved
@strongoier
Copy link
Contributor Author

Should this pass be placed after a simplify pass? IIUC the offset may be optimized to a constant after constant folding.

Currently scalarize() has to be placed before any other pass :-( The current version ensures the behavior is the same as before (no optimized constants are considered), but in the future scalarize() will be postponed and able to use those optimized constants.

Copy link
Contributor

@lin-hitonami lin-hitonami left a comment

Choose a reason for hiding this comment

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

LGTM

@lin-hitonami lin-hitonami merged commit b27d6c2 into taichi-dev:master Jan 5, 2023
@strongoier strongoier deleted the scal branch January 5, 2023 13:04
quadpixels pushed a commit to quadpixels/taichi that referenced this pull request May 13, 2023
Issue: taichi-dev#2590

### Brief Summary

Previously `ScalarizePointers` (which is for allocas) takes place only
when `dynamic_index=False`. In this PR, we automatically identify those
allocas only indexed with constants and get them scalarized, and let the
remaining allocas go through the code path for dynamic indexing. In this
way, we make old user programs behave the same regardless of the
`dynamic_index` option, and provide dynamic indexing support for new
user programs at the same time.

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lin Jiang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full-ci Run complete set of CI tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants