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: Revamp MultiSubDimension lowering #2411

Merged
merged 9 commits into from
Jul 17, 2024
Prev Previous commit
Next Next commit
compiler: Polish MultiSubDimension lowering
  • Loading branch information
FabioLuporini committed Jul 17, 2024
commit 801b0046f6f4b7b013e5d1dfd194d18facb1d813
4 changes: 2 additions & 2 deletions devito/ir/equations/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _(expr, mapper):
def _(d, mapper):
# TODO: to be implemented as soon as we drop the counter machinery in
# Grid.__subdomain_finalize__
return {}
pass


@_concretize_subdims.register(ConditionalDimension)
Expand All @@ -209,7 +209,7 @@ def _(d, mapper):
# Grid.__subdomain_finalize__
# TODO: call `_concretize_subdims(d.parent, mapper)` as the parent might be
# a SubDimension!
return {}
pass


@_concretize_subdims.register(MultiSubDimension)
Expand Down
4 changes: 2 additions & 2 deletions devito/passes/clusters/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def _lower_msd(dim, cluster):
@_lower_msd.register(MultiSubDimension)
def _(dim, cluster):
i_dim = dim.implicit_dimension
mapper = {t[0]: dim.functions[i_dim, mM]
for t, mM in zip(dim.thickness, dim.bounds_indices)}
mapper = {t: dim.functions[i_dim, mM]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would avoid for obvious confusion with stepping dim

for t, mM in zip(dim.tkns, dim.bounds_indices)}
return mapper, i_dim


Expand Down
13 changes: 9 additions & 4 deletions devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
from devito.types.constant import Constant

__all__ = ['Dimension', 'SpaceDimension', 'TimeDimension', 'DefaultDimension',
'CustomDimension', 'SteppingDimension', 'SubDimension', 'MultiSubDimension',
'ConditionalDimension', 'ModuloDimension', 'IncrDimension',
'BlockDimension', 'StencilDimension', 'VirtualDimension',
'Spacing', 'dimensions']
'CustomDimension', 'SteppingDimension', 'SubDimension',
'MultiSubDimension', 'ConditionalDimension', 'ModuloDimension',
'IncrDimension', 'BlockDimension', 'StencilDimension',
'VirtualDimension', 'Spacing', 'dimensions']


Thickness = namedtuple('Thickness', 'left right')
Expand Down Expand Up @@ -596,6 +596,11 @@ def rtkn(self):
# Shortcut for the right thickness symbol
return self.thickness.right[0]

@property
def tkns(self):
# Shortcut for both thickness symbols
return self.ltkn, self.rtkn


class SubDimension(AbstractSubDimension):

Expand Down