-
Notifications
You must be signed in to change notification settings - Fork 3
Optimised copy for mod #343
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
base: main
Are you sure you want to change the base?
Conversation
8126124 to
f952d00
Compare
builder/optimizations.cc
Outdated
| 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() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: put the is_unfolded first in the condition (short circuit the relatively expensive depends_on checks)
| var x(ctx, "x"); | ||
| var y(ctx, "y"); | ||
|
|
||
| const int kMod = 23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is too big to test the functionality, all of the copy fits in the first fold. I'd make this 3.
builder/optimizations.cc
Outdated
| 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() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
57b6003 to
ba503a6
Compare
Addresses #306