-
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] Eliminate redundant mod for SNode access under packed mode #6444
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for docsite-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
for more information, see https://pre-commit.ci
jim19930609
approved these changes
Oct 27, 2022
strongoier
added a commit
that referenced
this pull request
Nov 1, 2022
…acked mode (#6485) Issue: #6219 ### Brief Summary This PR adds optimization similar to #6444 for non-packed mode so that we can conduct fair comparisons regarding performance. After this PR, the benchmark script in #6219 runs `0.007s` on my local machine no matter `packed=True/False`. The tests are fixed because they are invalid - the out-of-bound access used to be hidden by the always inserted `BitExtractStmt` before this PR.
This was referenced Nov 18, 2022
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this pull request
May 13, 2023
…acked mode (taichi-dev#6485) Issue: taichi-dev#6219 ### Brief Summary This PR adds optimization similar to taichi-dev#6444 for non-packed mode so that we can conduct fair comparisons regarding performance. After this PR, the benchmark script in taichi-dev#6219 runs `0.007s` on my local machine no matter `packed=True/False`. The tests are fixed because they are invalid - the out-of-bound access used to be hidden by the always inserted `BitExtractStmt` before this PR.
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this pull request
May 13, 2023
…d mode (taichi-dev#6709) Issue: taichi-dev#6660 ### Brief Summary This PR applies the same optimization in taichi-dev#6444 to the `demote_dense_struct_fors` pass. 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #6219
Brief Summary
For the following example,
Under packed mode, if we want to access
x[105]
, we will calculate105 mod (10 * 30) div 30 = 3
for the coordinate in the first dense SNode, and105 mod 30 = 15
for the coordinate in the second dense SNode. We can see that105 mod (10 * 30)
is unnecessary because user coordinate (105
) is always less than the total shape (10 * 30
) of the axis. This PR eliminates such redundantmod
upon first coordinate extraction on an axis.On my local machine, the benchmark script in #6219 runs
0.030s
forpacked=False
,0.039s
forpacked=True
before this PR,0.007s
forpacked=True
after this PR (even faster thanpacked=False
becausepacked=False
still generates aBitExtractStmt
).This optimization ensures that no
mod
will be generated for accessingx[i, j]
in common use cases like