-
Notifications
You must be signed in to change notification settings - Fork 73
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
base: main
Are you sure you want to change the base?
add TaggedExpression #688
Changes from 1 commit
9233385
679d269
45e14e7
50adbc4
06ab987
d50f908
ee395c1
04d0739
9ae8936
0bbbaec
9529588
9e24cd6
e72dec0
c7f9ad0
df7ed9b
857e268
d5f3f5d
3d7df9f
6142a3b
b060d55
cc7efdc
56527b4
af5d019
f461722
3f9df15
2248b0e
bb758ad
5aabe8f
119e789
372e48f
0ef534e
5e5be1d
b54217d
a693fb0
4b5a8f4
1a48a34
dd419b0
ad08e3e
123a457
7b60f42
da547b6
c67eea6
9dce573
17ba240
9f93401
c3b4a82
04ae5c0
4ca4db4
854b4a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -636,10 +636,14 @@ class Op(ImmutableRecord): | |
|
||
A :class:`str` representing the kernel name where the operation occurred. | ||
|
||
.. attribute:: tags | ||
|
||
A :class:`frozenset` of tags to the operation. | ||
|
||
""" | ||
|
||
def __init__(self, dtype=None, name=None, count_granularity=None, | ||
kernel_name=None): | ||
kernel_name=None, tags=None): | ||
if count_granularity not in CountGranularity.ALL+[None]: | ||
raise ValueError("Op.__init__: count_granularity '%s' is " | ||
"not allowed. count_granularity options: %s" | ||
|
@@ -651,15 +655,17 @@ def __init__(self, dtype=None, name=None, count_granularity=None, | |
|
||
super().__init__(dtype=dtype, name=name, | ||
count_granularity=count_granularity, | ||
kernel_name=kernel_name) | ||
kernel_name=kernel_name, | ||
tags=tags) | ||
|
||
def __repr__(self): | ||
# Record.__repr__ overridden for consistent ordering and conciseness | ||
if self.kernel_name is not None: | ||
return (f"Op({self.dtype}, {self.name}, {self.count_granularity}," | ||
f' "{self.kernel_name}")') | ||
f' "{self.kernel_name}", {self.tags})') | ||
else: | ||
return f"Op({self.dtype}, {self.name}, {self.count_granularity})" | ||
return f"Op({self.dtype}, {self.name}, " + \ | ||
f"{self.count_granularity}, {self.tags})" | ||
|
||
# }}} | ||
|
||
|
@@ -724,7 +730,7 @@ class MemAccess(ImmutableRecord): | |
work-group executes on a single compute unit with all work-items within | ||
the work-group sharing local memory. A sub-group is an | ||
implementation-dependent grouping of work-items within a work-group, | ||
analagous to an NVIDIA CUDA warp. | ||
analogous to an NVIDIA CUDA warp. | ||
|
||
.. attribute:: kernel_name | ||
|
||
|
@@ -922,6 +928,12 @@ def map_constant(self, expr): | |
map_tagged_variable = map_constant | ||
map_variable = map_constant | ||
|
||
def map_with_tag(self, expr): | ||
opmap = self.rec(expr.expr) | ||
for op in opmap.count_map: | ||
op.tags = expr.tags | ||
return opmap | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would overwrite tags of subexpressions that already have tags.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is 50adbc4 what you had in mind? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, generally. |
||
|
||
def map_call(self, expr): | ||
from loopy.symbolic import ResolvedFunction | ||
assert isinstance(expr.function, ResolvedFunction) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it'd be nice to type those mapper methods. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done as part of 4ca4db4 |
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.
Could you type those newly-added mapper methods? I'm laying the groundwork for that in #897.
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.
Done as part of 4ca4db4