Optimised copy for mod - #343
Open
Aelphy wants to merge 2 commits into
Open
Conversation
Aelphy
force-pushed
the
aelphy/optimised_copy_for_mod
branch
from
May 22, 2024 16:20
8126124 to
f952d00
Compare
dsharlet
reviewed
May 22, 2024
| const bool is_unfolded = | ||
| !src_dim.fold_factor.defined() || | ||
| src_dim.fold_factor.same_as(dim::unfolded); | ||
| if (depends_on(m->a, dst_x).any() && !depends_on(m->b, dst_x).any() && |
Owner
There was a problem hiding this comment.
Nit: put the is_unfolded first in the condition (short circuit the relatively expensive depends_on checks)
dsharlet
reviewed
May 22, 2024
| var x(ctx, "x"); | ||
| var y(ctx, "y"); | ||
|
|
||
| const int kMod = 23; |
Owner
There was a problem hiding this comment.
This is too big to test the functionality, all of the copy fits in the first fold. I'd make this 3.
| const bool is_unfolded = | ||
| !src_dim.fold_factor.defined() || | ||
| src_dim.fold_factor.same_as(dim::unfolded); | ||
| if (depends_on(m->a, dst_x).any() && !depends_on(m->b, dst_x).any() && |
Owner
There was a problem hiding this comment.
I think you only need the depends_on check for m->b, not m->a. If that doesn't depend on a, we should have treated this as a broadcast.
| // Try to parse src_x = dst_x % fold_factor | ||
| if (const class mod* m = src_x.as<class mod>()) { | ||
| const bool is_unfolded = | ||
| !src_dim.fold_factor.defined() || |
Owner
There was a problem hiding this comment.
I don't think all of the callers set this now, it just starts out undefined. Thinking about this, this is quite tricky. We might need to track fold factors in the visitor so we can know what they are.
Aelphy
force-pushed
the
aelphy/optimised_copy_for_mod
branch
from
May 23, 2024 14:20
57b6003 to
ba503a6
Compare
This file contains hidden or 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
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.
Addresses #306