-
Notifications
You must be signed in to change notification settings - Fork 256
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
Open
FabioLuporini
wants to merge
16
commits into
main
Choose a base branch
from
smarter-tuner-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c95df15
compiler: Attach deriv_order to IndexDerivative
FabioLuporini 2e33358
compiler: Add cire-maxpar=compact mode
FabioLuporini 70127d5
compiler: Change blocking strategy in presence of guards
FabioLuporini 9b1b827
tests: Remove useless sympy.Float cast
FabioLuporini 19f14b6
compiler: Fix DDA involving TensorMoves
FabioLuporini 6465e62
compiler: Revamp to enable blocking before CIRE
FabioLuporini 6bca150
compiler: Drop unused SynthesizeBlocking.template
FabioLuporini 7569221
compiler: Comply with ruff
FabioLuporini 00b8319
compiler: Fix and simplify lower_aliases
FabioLuporini ebfb3da
compiler: Fix lower_aliases' sub-iterators construction
FabioLuporini d9da7bd
compiler: Avoid nonsensical hoisting out of VirtualDimensions
FabioLuporini 8d985c2
compiler: Improve Properties.is_sequential
FabioLuporini 2ef79c9
compiler: Tweak EqBlock/Cluster after rebasing
FabioLuporini 03d6f46
arch: Add -lineinfo with profiling=ncu
FabioLuporini 1feb2b9
misc: Isort happiness
FabioLuporini 53f0bd2
tests: Make test_visible_devices independent of pytest backgroup env
FabioLuporini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 ( | ||
| CacheInstances, as_tuple, cached_hash, filter_ordered, flatten, infer_dtype | ||
| ) | ||
|
|
@@ -112,7 +112,7 @@ def dimensions(self): | |
| @cached_property | ||
| def exprs_dimensions(self): | ||
| """ | ||
| The Dimensions that appear explicitly in the Cluster expressions. | ||
| The Dimensions that appear explicitly in the expressions. | ||
| """ | ||
| dims_explicit = {i for i in self.free_symbols if i.is_Dimension} | ||
| dims_implicit = {d for e in self.exprs for d in e.implicit_dims} | ||
|
|
@@ -121,7 +121,7 @@ def exprs_dimensions(self): | |
| @cached_property | ||
| def guards_dimensions(self): | ||
| """ | ||
| The Dimensions that appear explicitly in the Cluster guards. | ||
| The Dimensions that appear explicitly in the guards. | ||
| """ | ||
| syms_guards = {d for e in self.guards.values() for d in e.free_symbols} | ||
| dims_guards = {i for i in syms_guards if i.is_Dimension} | ||
|
|
@@ -142,7 +142,7 @@ def used_dimensions(self): | |
| @cached_property | ||
| def dist_dimensions(self): | ||
| """ | ||
| The Cluster's distributed Dimensions. | ||
| The distributed Dimensions. | ||
| """ | ||
| ret = set() | ||
| for f in self.functions: | ||
|
|
@@ -168,7 +168,7 @@ def grid(self): | |
| elif len(grids) == 1: | ||
| return grids.pop() | ||
| else: | ||
| raise ValueError("Cluster has no unique Grid") | ||
| raise ValueError("Multiple Grids detected") | ||
|
|
||
| @cached_property | ||
| def is_scalar(self): | ||
|
|
@@ -296,31 +296,27 @@ def is_glb_load_to_mem_shared(self): | |
| @cached_property | ||
| def is_async(self): | ||
| """ | ||
| True if an asynchronous Cluster, False otherwise. | ||
| True if asynchronous, False otherwise. | ||
| """ | ||
| return any(isinstance(s, (WithLock, PrefetchUpdate)) | ||
| for s in flatten(self.syncs.values())) | ||
|
|
||
| @cached_property | ||
| def is_wait(self): | ||
| """ | ||
| True if a Cluster waiting on a lock (that is a special synchronization | ||
| operation), False otherwise. | ||
| True if waiting on a lock (that is a special synchronization operation), | ||
| False otherwise. | ||
| """ | ||
| return any(isinstance(s, WaitLock) | ||
| for s in flatten(self.syncs.values())) | ||
|
|
||
| @cached_property | ||
| def dtype(self): | ||
| """ | ||
| The arithmetic data type of the Cluster. | ||
| The arithmetic data type of the enclosed expressions. | ||
|
|
||
| If the Cluster performs floating point arithmetic, then the expressions | ||
| performing integer arithmetic are ignored, assuming that they are only | ||
| carrying out array index calculations. | ||
|
|
||
| If two expressions perform calculations with different precision, | ||
| the data type with highest precision is returned. | ||
| If two expressions perform calculations with different precision, the data | ||
| type with highest precision is returned. | ||
| """ | ||
| dtypes = set() | ||
| for i in self.exprs: | ||
|
|
@@ -336,8 +332,8 @@ def dtype(self): | |
| @cached_property | ||
| def dspace(self): | ||
| """ | ||
| Derive the DataSpace of the Cluster from its expressions, | ||
| IterationSpace, and Guards. | ||
| The DataSpace deriving from the enclosed expressions, IterationSpace, | ||
| and Guards. | ||
| """ | ||
| accesses = detect_accesses(self.exprs) | ||
|
|
||
|
|
@@ -421,8 +417,8 @@ def ops(self): | |
| @cached_property | ||
| def traffic(self): | ||
| """ | ||
| The Cluster compulsory traffic (number of reads/writes), as a mapper | ||
| from Functions to IntervalGroups. | ||
| The compulsory traffic (number of reads/writes), as a mapper from | ||
| Functions to IntervalGroups. | ||
|
|
||
| Notes | ||
| ----- | ||
|
|
@@ -509,30 +505,6 @@ def __getattr__(self, name): | |
| raise AttributeError(name) from None | ||
| return getattr(block, name) | ||
|
|
||
| @property | ||
| def exprs(self): | ||
| return self._block.exprs | ||
|
|
||
| @property | ||
| def ispace(self): | ||
| return self._block.ispace | ||
|
|
||
| @property | ||
| def guards(self): | ||
| return self._block.guards | ||
|
|
||
| @property | ||
| def properties(self): | ||
| return self._block.properties | ||
|
|
||
| @property | ||
| def syncs(self): | ||
| return self._block.syncs | ||
|
|
||
| @property | ||
| def halo_scheme(self): | ||
| return self._block.halo_scheme | ||
|
|
||
| @classmethod | ||
| def from_clusters(cls, *clusters): | ||
| """ | ||
|
|
@@ -612,6 +584,33 @@ def rebuild(self, *args, **kwargs): | |
| syncs=syncs, | ||
| halo_scheme=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: | ||
| 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) | ||
|
|
||
|
|
||
| class ClusterGroup(tuple): | ||
|
|
||
|
|
@@ -691,6 +690,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) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
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.
enforced or things would break
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.
then it needs to be moved to line 81 below and prevent it from being a user option (i.e no oo.pop)