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

add TaggedExpression #688

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open

add TaggedExpression #688

wants to merge 39 commits into from

Conversation

matthiasdiener
Copy link
Collaborator

@matthiasdiener matthiasdiener commented Oct 7, 2022

TODOs:

  • add to MemAccess, Sync

Please squash

@matthiasdiener matthiasdiener changed the title Create WithTag add WithTag Oct 7, 2022
@matthiasdiener
Copy link
Collaborator Author

Is this going in the direction you had in mind @inducer ?

loopy/symbolic.py Outdated Show resolved Hide resolved
Comment on lines 932 to 935
opmap = self.rec(expr.expr)
for op in opmap.count_map:
op.tags = expr.tags
return opmap
Copy link
Owner

Choose a reason for hiding this comment

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

Would overwrite tags of subexpressions that already have tags.

self.rec(expr.expr, expr.tags)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is 50adbc4 what you had in mind?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, generally.

@matthiasdiener matthiasdiener changed the title add WithTag add TaggedExpression Oct 18, 2022

map_bitwise_xor = map_bitwise_or
map_bitwise_and = map_bitwise_or

def map_if(self, expr):
def map_if(self, expr, *args):
Copy link
Owner

Choose a reason for hiding this comment

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

Why switch to *args here?

Copy link
Collaborator Author

@matthiasdiener matthiasdiener Nov 9, 2022

Choose a reason for hiding this comment

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

In 0bbbaec, I changed all occurrences to tags (with a default argument). Does this look reasonable?

@inducer
Copy link
Owner

inducer commented Oct 18, 2022

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

@matthiasdiener matthiasdiener marked this pull request as ready for review November 9, 2022 23:32
@matthiasdiener
Copy link
Collaborator Author

This is ready for a first look @inducer.

@@ -916,14 +931,17 @@ def __init__(self, knl, callables_table, kernel_rec,
def combine(self, values):
return sum(values)

def map_constant(self, expr):
def map_constant(self, expr, tags=None):
Copy link
Owner

Choose a reason for hiding this comment

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

Why the pervasive tags=None? The default risks losing the tag as you traverse. IMO, there should not be a default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it in df7ed9b to not use a default argument anymore.

else:
return self.new_zero_poly_map()

map_product = map_sum

def map_comparison(self, expr):
return self.rec(expr.left)+self.rec(expr.right)
def map_comparison(self, expr, *args):
Copy link
Owner

Choose a reason for hiding this comment

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

Why have *args instead of tags here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are hopefully all fixed in df7ed9b

"""

def __init__(self, mtype=None, dtype=None, lid_strides=None, gid_strides=None,
direction=None, variable=None,
*, variable_tags=None,
count_granularity=None, kernel_name=None):
count_granularity=None, kernel_name=None, tags=None):
Copy link
Owner

Choose a reason for hiding this comment

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

Would it make sense to default this to an empty frozenset instead? (Here and elsewhere?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure - the other (non-scalar) fields in these classes also have None as the default value (e.g. variable_tags, lid_strides, ...)

@matthiasdiener matthiasdiener marked this pull request as draft November 7, 2024 16:08
@matthiasdiener
Copy link
Collaborator Author

This is ready for another look @inducer

@matthiasdiener

This comment was marked as outdated.

@matthiasdiener matthiasdiener marked this pull request as ready for review November 12, 2024 17:11
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