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

Remove the raising to high level operator within Unify Axis #565

Merged
merged 41 commits into from
Feb 5, 2025

Conversation

nkoskelo
Copy link
Contributor

No description provided.

pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
@inducer
Copy link
Owner

inducer commented Nov 25, 2024

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

@nkoskelo nkoskelo requested a review from inducer December 20, 2024 16:52
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
@nkoskelo nkoskelo requested a review from inducer January 16, 2025 01:44
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Show resolved Hide resolved
pytato/transform/metadata.py Show resolved Hide resolved
pytato/transform/metadata.py Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
if isinstance(var_ind_name, prim.Variable):
lhs: str = self.get_var_for_axis(expr.bindings[vname],
axis_ind)
if IDX_LAMBDA_INAME.fullmatch(var_ind_name.name):
Copy link
Owner

Choose a reason for hiding this comment

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

Add an else case here, to document that you've thought about it. E.g.

else:
    raise AssertionError()

pytato/transform/metadata.py Show resolved Hide resolved
pytato/transform/metadata.py Outdated Show resolved Hide resolved
@inducer
Copy link
Owner

inducer commented Jan 16, 2025

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

@nkoskelo nkoskelo marked this pull request as draft February 3, 2025 18:13
nkoskelo and others added 3 commits February 3, 2025 12:26
… version requires us to later check with the index lambda version as well. However, we do not want to convert the expressions to index lambdas permanently.
@nkoskelo nkoskelo marked this pull request as ready for review February 4, 2025 21:57
@nkoskelo nkoskelo requested a review from inducer February 4, 2025 22:33
Comment on lines 322 to 327
elif BINDING_NAME_RESERVED_PATTERN.fullmatch(ind_name):
raise AssertionError(f"Expression: {idx_lambda.expr}" +
"indexes into an array using a binding name.")
else:
raise AssertionError(f"Expression: {idx_lambda.expr}" +
"indexes into an array with an unknown variable name.")
Copy link
Owner

Choose a reason for hiding this comment

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

Why are these errors? They can happen (hence AssertionError is misplaced), and I wouldn't consider them illegal. (I've removed them.)

"""
return self.combine([base] + [self.rec(subexpr) for
subexpr in expr.index_tuple])
return {}
Copy link
Owner

Choose a reason for hiding this comment

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

This code path is missing a recursion. (I've added it.)

Comment on lines 563 to 567
for (ary, ax), ax_var in equations_collector.axis_to_var.items():
# Reduction axes do not follow AxisIgnoredForPropagation.
# They cannot propagate the information to descendant of the array anyway.
if isinstance(ax, int) and ary.axes[ax].tags_of_type(AxisIgnoredForPropagationTag): # noqa
ignored_vars.update({ax_var})
Copy link
Owner

Choose a reason for hiding this comment

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

Why shouldn't reduction axes participate in this?

Copy link
Owner

Choose a reason for hiding this comment

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

(I've added a FIXME.)

ind_name: str = var_ind_name.name
matched_pattern = IDX_LAMBDA_RESERVED_INDEX_PATTERN.fullmatch(ind_name) # noqa
if matched_pattern:
# matched with an axis index.
Copy link
Owner

Choose a reason for hiding this comment

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

Did we say this should only apply if the lengths match? (I've added that check.)

@inducer inducer force-pushed the remove-raising-revived branch from c47567a to 62f7fb4 Compare February 5, 2025 22:08
@inducer
Copy link
Owner

inducer commented Feb 5, 2025

Fixes for mypy will come via #581.

@inducer inducer enabled auto-merge (squash) February 5, 2025 22:53
@inducer inducer merged commit a34a9e5 into inducer:main Feb 5, 2025
11 checks passed
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