Skip to content

Conversation

@Aelphy
Copy link
Collaborator

@Aelphy Aelphy commented May 22, 2024

Addresses #306

@Aelphy Aelphy force-pushed the aelphy/optimised_copy_for_mod branch from 8126124 to f952d00 Compare May 22, 2024 16:20
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() &&
Copy link
Owner

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;
Copy link
Owner

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.

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() &&
Copy link
Owner

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() ||
Copy link
Owner

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.

@Aelphy Aelphy force-pushed the aelphy/optimised_copy_for_mod branch from 57b6003 to ba503a6 Compare May 23, 2024 14:20
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