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
Analysis at a higher level of abstraction #1027
Conversation
4aed90c
to
4a8e197
Compare
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.
Needs rebasing, right?
from devito.ir.iet import (IterationProperty, SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, | ||
VECTOR, WRAPPABLE, ROUNDABLE, AFFINE, OVERLAPPABLE) | ||
from devito.ir.support import Forward, detect_io | ||
from devito.ir.support import (SEQUENTIAL, PARALLEL, PARALLEL_IF_ATOMIC, VECTORIZED, |
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.
vectorizable?
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.
no
COLLAPSED = lambda i: Property('collapsed', i) | ||
"""Collapsing Dimensions.""" | ||
|
||
VECTORIZED = Property('vector-dim') |
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.
as before.. vectorizable?
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.
no, now it's really VECTORIZED
devito/operator/profiling.py
Outdated
@@ -104,7 +104,7 @@ def timer_on(self, name, comm=None): | |||
If provided, the global execution time is derived by a single MPI | |||
rank, with timers started and stopped right after an MPI barrier. | |||
""" | |||
if comm is not MPI.COMM_NULL: | |||
if comm and comm is not MPI.COMM_NULL: |
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 should have been spotted earlier on, right?
@@ -366,7 +366,7 @@ class Iteration(Node): | |||
The for-loop direction. Accepted: | |||
- ``Forward``: i += stepping (defaults) | |||
- ``Backward``: i -= stepping | |||
properties : IterationProperty or list of IterationProperty, optional | |||
properties : Property or list of Property, optional |
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 get the idea, but "Property" feels very vague/general, maybe "CompilerProperty" or "PasssProperty" or just keep the previous IterationProperty
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.
Would vote for IterationProperty
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 is not an IterationProperty (anymore), otherwise I'd have kept the original name
from devito.tools import Tag | ||
|
||
|
||
class Property(Tag): |
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.
As above, don't really like the name.
""" | ||
A modulo-N Dimension (i.e., cycling over i, i+1, i+2, ..., i+N-1) that could | ||
safely be turned into a modulo-K Dimension, with K < N. For example: | ||
u[t+1, ...] = f(u[t, ...], u[t-1, ...]) --> u[t-1, ...] = f(u[t, ...], u[t-1, ...]). |
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.
that's t-1
on both side of =
in the second part.
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.
yes, that's the point. A very special case in which you could get away with two timeslots instead of three (here it's t-1 and t, could have been t+1 and t)
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.
If it's inside f
it's note the case as it implies it's not just a overwrite but need to know t-1
everywhere.
tests/test_autotuner.py
Outdated
@@ -96,7 +96,7 @@ def test_mode_destructive(): | |||
grid = Grid(shape=(96, 96, 96)) | |||
f = TimeFunction(name='f', grid=grid, time_order=0) | |||
|
|||
op = Operator(Eq(f, f + 1.), dle=('advanced', {'openmp': False})) | |||
op = Operator(Eq(f.forward, f + 1.), dle=('advanced', {'openmp': False})) |
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.
I think it was just a leftover. I have reinstated the origin version
@@ -498,7 +498,7 @@ def test_default_functions(self): | |||
grid = Grid(shape=(5, 6, 7)) | |||
f = TimeFunction(name='f', grid=grid) | |||
g = Function(name='g', grid=grid) | |||
op = Operator(Eq(g, g + f), dle=('advanced', {'openmp': False})) | |||
op = Operator(Eq(f.forward, g + f), dle=('advanced', {'openmp': False})) |
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.
f
would have worked too.
But not g
. With g
on the LHS, this is a fully parallel loop nest -- you may go in parallel even over time -- and heuristically the compiler doesn't do blocking if there is not at least one SEQUENTIAL Iteration
the test however expects x0_blk_size
, ie it expects blocking, so...
""" | ||
return Cluster(exprs, self.ispace, self.dspace, self.guards) | ||
# Shortcut for backwards compatibility |
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 raise a warning if this is only there for backward compatibility.
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.
oh no this is just an internal thing
and in fact, no worries -- this is changing again in one of the subsequent PRs (getting a proper cleanup)
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.
Addressed your comments + rebased on latest master
I'll stick to Property for now, but I'll think of a better name before landing the next PR. Though to be fair it's not ambiguous, so it seems OK to me
tests/test_autotuner.py
Outdated
@@ -96,7 +96,7 @@ def test_mode_destructive(): | |||
grid = Grid(shape=(96, 96, 96)) | |||
f = TimeFunction(name='f', grid=grid, time_order=0) | |||
|
|||
op = Operator(Eq(f, f + 1.), dle=('advanced', {'openmp': False})) | |||
op = Operator(Eq(f.forward, f + 1.), dle=('advanced', {'openmp': False})) |
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 think it was just a leftover. I have reinstated the origin version
@@ -498,7 +498,7 @@ def test_default_functions(self): | |||
grid = Grid(shape=(5, 6, 7)) | |||
f = TimeFunction(name='f', grid=grid) | |||
g = Function(name='g', grid=grid) | |||
op = Operator(Eq(g, g + f), dle=('advanced', {'openmp': False})) | |||
op = Operator(Eq(f.forward, g + f), dle=('advanced', {'openmp': False})) |
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.
f
would have worked too.
But not g
. With g
on the LHS, this is a fully parallel loop nest -- you may go in parallel even over time -- and heuristically the compiler doesn't do blocking if there is not at least one SEQUENTIAL Iteration
the test however expects x0_blk_size
, ie it expects blocking, so...
""" | ||
return Cluster(exprs, self.ispace, self.dspace, self.guards) | ||
# Shortcut for backwards compatibility |
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.
oh no this is just an internal thing
and in fact, no worries -- this is changing again in one of the subsequent PRs (getting a proper cleanup)
4a8e197
to
7e5d2f2
Compare
Codecov Report
@@ Coverage Diff @@
## master #1027 +/- ##
==========================================
+ Coverage 88.71% 88.73% +0.01%
==========================================
Files 116 118 +2
Lines 14715 14742 +27
Branches 2722 2710 -12
==========================================
+ Hits 13055 13081 +26
- Misses 1315 1316 +1
Partials 345 345
Continue to review full report at Codecov.
|
WARNING: this PR is based on top of #1026 , so it's pointless to look at the diff with master until #1026 will have been merged.
This PR moves several analysis passes from the IET level to the Cluster level.
No new functionality is added. This is in preparation for another PR.