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
Merged

Conversation

FabioLuporini
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 81.48148% with 25 lines in your changes missing coverage. Please review.

Project coverage is 86.71%. Comparing base (3054604) to head (a35c7db).

Files Patch % Lines
devito/ir/equations/algorithms.py 67.39% 13 Missing and 2 partials ⚠️
devito/types/dimension.py 87.67% 6 Missing and 3 partials ⚠️
devito/passes/clusters/implicit.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2411      +/-   ##
==========================================
- Coverage   86.75%   86.71%   -0.04%     
==========================================
  Files         235      235              
  Lines       44610    44652      +42     
  Branches     8257     8273      +16     
==========================================
+ Hits        38702    38721      +19     
- Misses       5189     5206      +17     
- Partials      719      725       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

bounds_indices=(2*i, 2*i+1),
implicit_dimension=i_dim))

ltkn = Symbol(name="%s_ltkn%d" % (d.name, counter), dtype=np.int32,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NOTE: this is at the moment redundant (see changes to /ir/equations/algorithms above) but it will soon be dropped by a subsequent PR

Copy link
Contributor

@mloubout mloubout left a comment

Choose a reason for hiding this comment

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

Couple nitpicky comments but looks good

pass
return ispace
def make_implicit_exprs(mapper):
return [Eq(list(d._thickness_map)[side], v) for (d, side), v in mapper.items()]
Copy link
Contributor

Choose a reason for hiding this comment

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

No the nicest, would be better to have easy access d.thickness_val(side)

rtkn = Symbol(name="%s_rtkn%d" % (d.name, counter), dtype=np.int32,
is_const=True, nonnegative=True)

left = d.symbolic_min + ltkn
Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't this done in the Dimension's init?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seconded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in AbstractSubDimension.__init__ though, because SubDimension gets custom left/right depending on whether it's a left/right/middle SubDimension

self.bounds_indices = bounds_indices
self.implicit_dimension = implicit_dimension

def __hash__(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we drop this?

Copy link
Contributor Author

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 will leave it to you to figure it out in your upcoming branch, since conceptually more related to this thing

@@ -236,8 +221,8 @@ def _lower_msd(dim, cluster):
@_lower_msd.register(MultiSubDimension)
def _(dim, cluster):
i_dim = dim.implicit_dimension
mapper = {(dim.root, i): dim.functions[i_dim, mM]
for i, mM in enumerate(dim.bounds_indices)}
mapper = {t[0]: dim.functions[i_dim, mM]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EdCaunt this change broke PRO's sibling PR, will fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also, we should avoid magic numbers at all costs, and 0 here is a magic number

Copy link
Contributor

Choose a reason for hiding this comment

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

I've got a fix for it already. Will push it

@FabioLuporini FabioLuporini force-pushed the revamp-msd-lowering branch 2 times, most recently from 4e4b416 to 82fa38f Compare July 17, 2024 08:56
@@ -236,8 +221,8 @@ def _lower_msd(dim, cluster):
@_lower_msd.register(MultiSubDimension)
def _(dim, cluster):
i_dim = dim.implicit_dimension
mapper = {(dim.root, i): dim.functions[i_dim, mM]
for i, mM in enumerate(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

bounds_indices=(2*i, 2*i+1),
implicit_dimension=i_dim))

thickness = MultiSubDimension._symbolic_thickness(dname)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can move that in the MultiSubDimension init and just input None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EdCaunt can u do it in your upcoming PR

Copy link
Contributor

@mloubout mloubout left a comment

Choose a reason for hiding this comment

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

Looking good

@mloubout mloubout merged commit 0706ced into master Jul 17, 2024
30 of 31 checks passed
@mloubout mloubout deleted the revamp-msd-lowering branch July 17, 2024 16:23
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.

4 participants