-
Notifications
You must be signed in to change notification settings - Fork 230
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
compiler: Rework multi-level buffering #2225
Conversation
for d in self.target.dimensions] | ||
return IMask(*ret, getters=self.target.dimensions, function=self.function, | ||
ret = [] | ||
for d in self.target.dimensions: |
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.
mere refactoring for code homogeneity (see below...)
ret = [] | ||
for d in self.target.dimensions: | ||
if d.root is self.dim.root: | ||
if self.target.is_regular: |
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.
added this; code path excited via PRO
# Special case: avoid initialization in the case of double | ||
# (or multiple levels of) buffering because it will have been | ||
# already performed | ||
if b.size > 1 and b.multi_buffering: |
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.
code path excited via PRO
# different actions. Multi-level is trivial, because it essentially | ||
# inherits metadata from the previous buffering level | ||
if self.multi_buffering: | ||
self.__init_multi_buffering__() |
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.
code path excited via PRO
dims = list(function.dimensions) | ||
assert dim in function.dimensions | ||
|
||
# Determine the buffer size, and therefore the span of the ModuloDimension, |
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.
None of this is gone; simply moved inside __init_firstlevel_buffering__
@@ -462,6 +424,85 @@ def __init__(self, function, dim, d, accessv, cache, options, sregistry): | |||
except TypeError: | |||
self.buffer = cache[function] = Array(**kwargs) | |||
|
|||
def __init_multi_buffering__(self): |
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.
this is basically the only true new part
else: | ||
self.index_mapper[idx0] = idx1 | ||
|
||
def __init_firstlevel_buffering__(self, async_degree, sregistry): |
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.
already existing, simply refactored inside this method
Codecov Report
@@ Coverage Diff @@
## master #2225 +/- ##
==========================================
- Coverage 87.11% 86.95% -0.17%
==========================================
Files 228 228
Lines 40810 40859 +49
Branches 7471 7482 +11
==========================================
- Hits 35551 35528 -23
- Misses 4653 4726 +73
+ Partials 606 605 -1
|
@@ -257,7 +258,7 @@ def _actions_from_update_memcpy(self, cluster, clusters, prefix, actions): | |||
|
|||
# If fetching into e.g. `ub[sb1]` we'll need to prefetch into e.g. `ub[sb0]` | |||
tindex0 = e.lhs.indices[d] | |||
if is_integer(tindex0): | |||
if is_integer(tindex0) or isinstance(tindex0, IntDiv): |
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.
Maybe add or isintance(tindex0, Mod)
for case someone use % instead of IntDiv
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.
for that you end up in the else
, deliberately :)
what you see here isn't stuff that the user has written, but rather by-product expressions of other passes such as buffering
See comments next to code for more info