-
Notifications
You must be signed in to change notification settings - Fork 255
compiler: Enable blocking-before-CIRE #2948
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
base: main
Are you sure you want to change the base?
Changes from all commits
140b3a5
83c510d
1ef0ada
ca96cdf
3de03ca
f67a3c1
ff9b906
f3c20e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| ) | ||
| from devito.mpi.halo_scheme import HaloScheme, HaloTouch | ||
| from devito.mpi.reduction_scheme import DistReduce | ||
| from devito.symbolics import estimate_cost | ||
| from devito.symbolics import estimate_cost, uxreplace | ||
| from devito.tools import as_tuple, filter_ordered, flatten, infer_dtype | ||
| from devito.types import ( | ||
| CriticalRegion, Fence, Indexed, PhaseMarker, TensorMove, ThreadArrive, ThreadCommit, | ||
|
|
@@ -128,6 +128,33 @@ def rebuild(self, *args, **kwargs): | |
| syncs=kwargs.get('syncs', self.syncs), | ||
| halo_scheme=kwargs.get('halo_scheme', self.halo_scheme)) | ||
|
|
||
| def subs(self, mapper, compact=()): | ||
| """ | ||
| Build a new Cluster applying substitutions rules to `self`. | ||
| """ | ||
| if not mapper: | ||
| return self | ||
|
|
||
| if self.halo_scheme: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can probably be relaxed to |
||
| raise NotImplementedError | ||
|
|
||
| key0 = lambda i: i.is_Block | ||
| subs0 = {d: self.ispace[d].promote(key0).dim for d in compact} | ||
|
|
||
| subs = {**mapper, **subs0} | ||
| exprs = [uxreplace(e, subs) for e in self.exprs] | ||
|
|
||
| ispace = self.ispace.switch(mapper) | ||
| key = lambda i: key0(i) and i in flatten(d._defines for d in subs0) | ||
| ispace = ispace.promote(key, mode='total') | ||
|
|
||
| guards = self.guards.subs(mapper).promote(subs0) | ||
| properties = self.properties.subs(mapper).promote(subs0) | ||
| syncs = self.syncs.subs(mapper) | ||
|
|
||
| return self.__class__(exprs=exprs, ispace=ispace, guards=guards, | ||
| properties=properties, syncs=syncs) | ||
|
|
||
| @property | ||
| def exprs(self): | ||
| return self._exprs | ||
|
|
@@ -591,6 +618,14 @@ def dspace(self): | |
| """Return the DataSpace of this ClusterGroup.""" | ||
| return DataSpace.union(*[i.dspace.reset() for i in self]) | ||
|
|
||
| @property | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cached? |
||
| def is_dense(self): | ||
| return all(i.is_dense for i in self) | ||
|
|
||
| @property | ||
| def is_wild(self): | ||
| return all(i.is_wild for i in self) | ||
|
|
||
| @property | ||
| def is_halo_touch(self): | ||
| return all(i.is_halo_touch for i in self) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,11 +15,11 @@ | |
| ) | ||
| from devito.tools import ( | ||
| CacheInstances, Tag, as_mapper, as_tuple, filter_sorted, flatten, is_integer, | ||
| memoized_generator, memoized_meth, smart_gt, smart_lt | ||
| memoized_generator, memoized_meth, smart_gt, smart_lt, split | ||
| ) | ||
| from devito.types import ( | ||
| ComponentAccess, CriticalRegion, Dimension, DimensionTuple, Fence, Function, Symbol, | ||
| TBArray, Temp, TempArray | ||
| TBArray, Temp, TempArray, TensorMove | ||
| ) | ||
|
|
||
| __all__ = ['ExprGeometry', 'IterationInstance', 'Scope', 'TimedAccess'] | ||
|
|
@@ -1383,19 +1383,31 @@ def vinf(entries): | |
|
|
||
| def retrieve_accesses(exprs, **kwargs): | ||
| """ | ||
| Like retrieve_terminals, but ensure that if a ComponentAccess is found, | ||
| the ComponentAccess itself is returned, while the wrapped Indexed is discarded. | ||
| Similar to `retrieve_terminals`, but with some adjustments: | ||
|
|
||
| * ComponentAccess's are retained, but the wrapped Indexed are discarded; | ||
| * TensorMove's are upcasted to the logical Indexed they represent. | ||
| """ | ||
| kwargs['mode'] = 'unique' | ||
|
|
||
| compaccs = search(exprs, ComponentAccess) | ||
| if not compaccs: | ||
| return retrieve_terminals(exprs, **kwargs) | ||
|
|
||
| subs = {i: Symbol(f'dummy{n}') for n, i in enumerate(compaccs)} | ||
| exprs1 = uxreplace(exprs, subs) | ||
| if compaccs: | ||
| # Handle ComponentAccesses | ||
| subs = {i: Symbol(f'dummy{n}') for n, i in enumerate(compaccs)} | ||
| exprs1 = uxreplace(exprs, subs) | ||
| terms1 = retrieve_terminals(exprs1, **kwargs) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would likely be "cheaper" to have an |
||
|
|
||
| accesses = compaccs | terms1 - set(subs.values()) | ||
| else: | ||
| accesses = retrieve_terminals(exprs, **kwargs) | ||
|
|
||
| # Handle TensorMoves | ||
| key = lambda i: isinstance(i, TensorMove) | ||
| tmovs, other = split(accesses, key) | ||
| accesses = {i.access for i in tmovs} | other | ||
|
|
||
| return compaccs | retrieve_terminals(exprs1, **kwargs) - set(subs.values()) | ||
| return accesses | ||
|
|
||
|
|
||
| def disjoint_test(e0, e1, d, it): | ||
|
|
||
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.
Is it intended to be a default or enforced?