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

template matching: only look at the inner dims of the schedule #351

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

jorendumoulin
Copy link
Contributor

stacked on #349

with this PR, when doing a template check with a template and a schedule, previously they are forced to the same number of dims. This PR checks if the schedule has larger dimensionality than the template, and reduces it to the number of dims of the template in this case.

Copy link
Contributor

@JosseVanDelm JosseVanDelm left a comment

Choose a reason for hiding this comment

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

Looks good!

sp_non_matching_pattern = SchedulePattern(
bounds,
AffineMap(
num_dims=2, num_symbols=0, results=(AffineDimExpr(1), AffineDimExpr(0))
),
)
assert tp.matches(sp_non_matching_pattern) is False

# check pattern with wrong bounds (should be irellevant for template check)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# check pattern with wrong bounds (should be irellevant for template check)
# check pattern with wrong bounds (should be irrelevant for template check)

@@ -196,6 +196,8 @@ def matches(self, sp: SchedulePattern):
Check if a given schedule pattern matches this
template pattern.
"""
if sp.num_dims > self.num_dims:
sp = sp.inner_dims(self.num_dims)
if sp.num_dims != self.num_dims:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe make this more explicit?

Suggested change
if sp.num_dims != self.num_dims:
elif sp.num_dims < self.num_dims:

Base automatically changed from joren/access-pattern-inner-dims to main January 29, 2025 07:23
@jorendumoulin jorendumoulin force-pushed the joren/template-match-inner branch from a04dc2b to d08edb2 Compare January 29, 2025 07:27
@jorendumoulin jorendumoulin merged commit 453a813 into main Jan 29, 2025
14 checks passed
@jorendumoulin jorendumoulin deleted the joren/template-match-inner branch January 29, 2025 07:29
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.

2 participants