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

compiler: Rework multi-level buffering #2225

Merged
merged 6 commits into from
Oct 6, 2023
Merged

Conversation

FabioLuporini
Copy link
Contributor

See comments next to code for more info

for d in self.target.dimensions]
return IMask(*ret, getters=self.target.dimensions, function=self.function,
ret = []
for d in self.target.dimensions:
Copy link
Contributor Author

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:
Copy link
Contributor Author

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:
Copy link
Contributor Author

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__()
Copy link
Contributor Author

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,
Copy link
Contributor Author

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):
Copy link
Contributor Author

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):
Copy link
Contributor Author

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
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #2225 (82e47f9) into master (2d355c2) will decrease coverage by 0.17%.
The diff coverage is 58.00%.

@@            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     
Files Coverage Δ
devito/passes/clusters/utils.py 96.77% <100.00%> (+0.62%) ⬆️
devito/types/dimension.py 93.51% <100.00%> (+0.02%) ⬆️
tests/test_dle.py 96.06% <ø> (ø)
devito/passes/clusters/misc.py 88.70% <40.00%> (-1.09%) ⬇️
devito/passes/clusters/asynchrony.py 12.29% <37.50%> (+0.65%) ⬆️
devito/ir/support/syncs.py 57.53% <0.00%> (-9.14%) ⬇️
devito/passes/clusters/buffering.py 87.50% <68.75%> (-3.69%) ⬇️

... and 3 files with indirect coverage changes

@@ -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):
Copy link
Contributor

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

Copy link
Contributor Author

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

@FabioLuporini FabioLuporini merged commit e6cd0b0 into master Oct 6, 2023
32 checks passed
@FabioLuporini FabioLuporini deleted the fix-timederiv-ctf branch October 6, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants