-
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: Refactorings, simplifications, generalizations #1810
Conversation
|
||
def lshw_gpu_info(text): | ||
def lshw_single_gpu_info(text): | ||
def homogenise_gpus(gpu_infos): |
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.
here u see a big diff, but it's mostly due to indentation...
|
||
gpu_info = homogenise_gpus(gpu_infos) | ||
|
||
# Also attach callbacks to retrieve instantaneous memory info |
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 really the only new part
the Devito compiler) to ensure data coherence. 'uniform', instead, | ||
means the Array will be used as if the underlying node had uniform | ||
memory address space. | ||
The memory space. Allowed values: 'local', 'mapped'. Defaults to 'local'. |
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.
simplifcations...
@@ -790,76 +795,9 @@ def free_symbols(self): | |||
_pickle_kwargs = DerivedDimension._pickle_kwargs + ['factor', 'condition', 'indirect'] | |||
|
|||
|
|||
class SteppingDimension(DerivedDimension): |
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 was not dropped -- just moved below towards the bottom of the file!
Codecov Report
@@ Coverage Diff @@
## master #1810 +/- ##
==========================================
- Coverage 89.60% 89.57% -0.04%
==========================================
Files 209 209
Lines 34307 34379 +72
Branches 5198 5197 -1
==========================================
+ Hits 30741 30794 +53
- Misses 3077 3097 +20
+ Partials 489 488 -1
Continue to review full report at Codecov.
|
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.
Looks like a nice cleanup. Will make a full pass over the next few days.
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.
A zero-level review. Will look properly next days. Interesting work done!
devito/ir/equations/equation.py
Outdated
if d.is_SubIterator: | ||
iterators.setdefault(d.root, set()).add(d) | ||
elif d.is_Conditional: | ||
# Use `parent`, and `root`, because a ConditionalDimenion may |
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.
typo
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.
OK, fixing
devito/ir/equations/equation.py
Outdated
|
||
There are two main differences between a LoweredEq and a | ||
ClusterizedEq: | ||
|
||
* In a ClusterizedEq, the iteration and data spaces must *always* | ||
be provided by the caller. | ||
* In a ClusterizedEq, the iteration space must *always* be provided |
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.
the IterationSpace
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.
OK
|
||
collapsable = self._find_collapsable(root, candidates) | ||
root, collapsable = self._select_candidates(candidates) |
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.
hmm....maybe better before...
@@ -36,13 +36,11 @@ class Dimension(ArgProvider): | |||
| | |||
--------------------------- | |||
| | | |||
BasicDimension DefaultDimension | |||
DerivedDimension DefaultDimension |
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 add all DImension subclasses to this plot?
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 the upper part of the docstring says, just the API classes
@@ -2565,11 +2572,11 @@ def test_fullopt(self): | |||
|
|||
# Check expected opcount/oi | |||
assert summary[('section1', None)].ops == 90 | |||
assert np.isclose(summary[('section1', None)].oi, 1.511, atol=0.001) | |||
assert np.isclose(summary[('section1', None)].oi, 2.031, atol=0.001) |
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.
byproduct of a more accurate dspace calculation
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.
seems way.. more accurate..
devito/arch/archinfo.py
Outdated
def lshw_single_gpu_info(text): | ||
def homogenise_gpus(gpu_infos): | ||
""" | ||
Run homogeneity checks on a list of GPU, return GPU with count if |
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.
list of GPUs
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.
OK
@@ -56,11 +56,15 @@ def autotune(operator, args, level, mode): | |||
if mode in ['preemptive', 'destructive']: | |||
for p in operator.parameters: | |||
if isinstance(p, MPINeighborhood): | |||
at_args.update(MPINeighborhood(p.neighborhood)._arg_values()) | |||
at_args.update( |
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.
needed this change?
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's just to make the code more homogeneous. The line below had to be split over multiple lines due to the additions of the args
argument, so I did the same aesthetic change here
52994a2
to
d9ae5f1
Compare
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
79b00a2
to
45e6e23
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.
pushing revisions now
devito/arch/archinfo.py
Outdated
def lshw_single_gpu_info(text): | ||
def homogenise_gpus(gpu_infos): | ||
""" | ||
Run homogeneity checks on a list of GPU, return GPU with count if |
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.
OK
@@ -56,11 +56,15 @@ def autotune(operator, args, level, mode): | |||
if mode in ['preemptive', 'destructive']: | |||
for p in operator.parameters: | |||
if isinstance(p, MPINeighborhood): | |||
at_args.update(MPINeighborhood(p.neighborhood)._arg_values()) | |||
at_args.update( |
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's just to make the code more homogeneous. The line below had to be split over multiple lines due to the additions of the args
argument, so I did the same aesthetic change here
devito/ir/equations/equation.py
Outdated
if d.is_SubIterator: | ||
iterators.setdefault(d.root, set()).add(d) | ||
elif d.is_Conditional: | ||
# Use `parent`, and `root`, because a ConditionalDimenion may |
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.
OK, fixing
devito/ir/equations/equation.py
Outdated
|
||
There are two main differences between a LoweredEq and a | ||
ClusterizedEq: | ||
|
||
* In a ClusterizedEq, the iteration and data spaces must *always* | ||
be provided by the caller. | ||
* In a ClusterizedEq, the iteration space must *always* be provided |
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.
OK
@@ -36,13 +36,11 @@ class Dimension(ArgProvider): | |||
| | |||
--------------------------- | |||
| | | |||
BasicDimension DefaultDimension | |||
DerivedDimension DefaultDimension |
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 the upper part of the docstring says, just the API classes
@@ -2565,11 +2572,11 @@ def test_fullopt(self): | |||
|
|||
# Check expected opcount/oi | |||
assert summary[('section1', None)].ops == 90 | |||
assert np.isclose(summary[('section1', None)].oi, 1.511, atol=0.001) | |||
assert np.isclose(summary[('section1', None)].oi, 2.031, atol=0.001) |
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.
byproduct of a more accurate dspace calculation
93b1b26
to
e9fbe13
Compare
b78623c
to
97f6f30
Compare
97f6f30
to
7a4bfab
Compare
@@ -182,6 +173,14 @@ def has_increments(self): | |||
def is_scalar(self): | |||
return not any(f.is_Function for f in self.scope.writes) | |||
|
|||
@cached_property | |||
def grid(self): |
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 wonder whether this could help with some bugs that we have seen in the past..... need to search ...
@@ -47,9 +47,19 @@ | |||
} | |||
|
|||
|
|||
def _set_log_level(level): |
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.
Do we need both _set_log_level, set_log_level ?
@@ -792,9 +800,9 @@ def test_nested_cache_blocking_structure_subdims(self, blocklevels): | |||
@pytest.mark.parametrize('exprs,collapsed,scheduling', [ |
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.
So we are OK with this? Maybe we can drop some of them since there is no diff now.
@@ -2565,11 +2572,11 @@ def test_fullopt(self): | |||
|
|||
# Check expected opcount/oi | |||
assert summary[('section1', None)].ops == 90 | |||
assert np.isclose(summary[('section1', None)].oi, 1.511, atol=0.001) | |||
assert np.isclose(summary[('section1', None)].oi, 2.031, atol=0.001) |
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.
seems way.. more accurate..
As the title says, zero new features introduced by this PR.
The main changes are the following:
ir/support/guards.py
Stencil
class fromir/support/stencil.py
, most ofDataSpace
, ...)Dimension
hierarchy was refactored. Now there'sIncrDimension
andBlockDimension
, the latter for loop blocking. They inherit from the same class, which contains most of the logic,AbstractIncrDimension
. They behave the same! But explicit distinction helps with making the code neater in more than one place. Also, theis_SubIterator
class property could be introduced, which introduces a clear separation between Dimensions that cannot create loops (the SubIterators...) and the other ones (like Dimension, SubDimension, CustomDimension)I will also add comments to the code to guide the reviewing
fixes #1771