-
Notifications
You must be signed in to change notification settings - Fork 229
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: Drop SubDomainSet earlier during compilation for more graceful lowering #2393
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2393 +/- ##
=======================================
Coverage 86.74% 86.74%
=======================================
Files 235 235
Lines 44542 44553 +11
Branches 8247 8250 +3
=======================================
+ Hits 38637 38647 +10
- Misses 5186 5187 +1
Partials 719 719 ☔ View full report in Codecov by Sentry. |
devito/passes/clusters/implicit.py
Outdated
@@ -94,8 +91,12 @@ def callback(self, clusters, prefix): | |||
processed.append(c) | |||
continue | |||
|
|||
msdims = [msdim(i.dim) for i in c.ispace[idx:]] |
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.
{msdim(i.dim) for i in c.ispace[idx:]} - {None}
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.
I suppose the mapper is unordered, so can use a set here. Good spot
devito/passes/clusters/implicit.py
Outdated
@@ -169,8 +170,12 @@ def callback(self, clusters, prefix): | |||
except IndexError: | |||
continue | |||
|
|||
msdims = [i.dim for i in ispace] |
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.
same
devito/passes/clusters/implicit.py
Outdated
# Get the dynamic thickness mapper for the given MultiSubDomain | ||
mapper, dims = lower_msd(d.msd, c) | ||
mapper, dims = lower_msd(msdims) | ||
# mapper, dims = lower_msd(d.msd, c) |
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.
leftover
devito/passes/clusters/implicit.py
Outdated
for d in msdims: | ||
# Pull out the parent MultiSubDimension if blocked etc | ||
msds = [d for d in d._defines if d.is_MultiSub] | ||
assert len(msds) == 1 # Sanity check. MultiSubDimensions shouldn't be nested. |
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.
why?
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.
Just for safety before the .pop()
. Means that it will throw an error rather than failing cryptically if anything does go wrong/is overlooked
devito/types/grid.py
Outdated
f[j].data[:] = self._local_bounds[idx] | ||
|
||
d._implicit_dimension = i_dim | ||
d._functions = f |
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.
modifying d
isn't great should rebuild it or create a new one
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 within the lazy constructor, so it's kinda acceptable
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.
Was able to shuffle things around, remove the modification, and reduce the number of lines
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.
Left some comments; note that changing the lower_msd
interface will also break PRO
devito/types/grid.py
Outdated
# to create the implicit equations. Untangling this is definitely | ||
# possible, but not straightforward | ||
self.msd = msd | ||
__rargs__ = ('name', 'parent') |
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.
Given https://github.com/devitocodes/devito/blob/master/devito/types/dimension.py#L494 I don't think you need this line
devito/passes/clusters/implicit.py
Outdated
mapper, dims = lower_msd(d.msd, c) | ||
# Get all MultiSubDimensions in the cluster and get the dynamic thickness | ||
# mapper for the associated MultiSubDomain | ||
mapper, dims = lower_msd({msdim(i.dim) for i in c.ispace[idx:]} - {None}) |
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.
I'm not sure I understand this change. If you are visiting d
, why do you need its msd as well as any other nested msds ?
I don't think this is particularly clean, but besides that, I'm failing to understand why
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.
lower_msd
has been completely replaced. Now stands for "lower multisubdimension" and takes all the multisubdimensions present in the cluster, rather than the multisubdomain attached to the outermost dimension (all references to which have been dropped at this point).
devito/passes/clusters/implicit.py
Outdated
@@ -170,7 +169,7 @@ def callback(self, clusters, prefix): | |||
continue | |||
|
|||
# Get the dynamic thickness mapper for the given MultiSubDomain | |||
mapper, dims = lower_msd(d.msd, c) | |||
mapper, dims = lower_msd({i.dim for i in ispace}) |
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.
same story as above
aa59e18
to
27ad936
Compare
devito/types/grid.py
Outdated
for j in range(2): | ||
idx = 2*i + j | ||
if isinstance(self._local_bounds[idx], int): | ||
sd_func.data[:, idx] = np.full((self._n_domains,), |
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.
why not just sd_func.data[:, idx] = self._local_bounds[idx]
?
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.
Good spot. Also removes a bunch of extra complexity
devito/passes/clusters/implicit.py
Outdated
@@ -170,7 +172,7 @@ def callback(self, clusters, prefix): | |||
continue | |||
|
|||
# Get the dynamic thickness mapper for the given MultiSubDomain | |||
mapper, dims = lower_msd(d.msd, c) | |||
mapper, dims = lower_msd({i.dim for i in ispace}, c) |
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 just ispace.itdims
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.
can do in another PR
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.
It'll get forgotten if it isn't done here, so will just do it
14f6fb0
to
e9393e7
Compare
e9393e7
to
b306e07
Compare
No description provided.