-
Notifications
You must be signed in to change notification settings - Fork 248
compiler: Enhance IR to support more advanced parlang (CUDA/HIP/SYCL) features #2840
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
22
commits into
main
Choose a base branch
from
the-TMA
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
22 commits
Select commit
Hold shift + click to select a range
37f2c14
compiler: Add FunctionMap type
FabioLuporini fea9884
compiler: Add ULONG to __all__
FabioLuporini cb6bad3
compiler: Improve lowering of LocalObjects
FabioLuporini 02a9f9f
compiler: Add LocalObject._mem_shared
FabioLuporini a530eef
compiler: Add LocalType._C_tag
FabioLuporini 873f8a0
compiler: Move and enhance FunctionMap
FabioLuporini ddb877e
arch: async-loads -> async-pipe
FabioLuporini 01255cf
compiler: Fix IREq.__repr__
FabioLuporini cc4a53f
compiler: Generalize ideriv lowering
FabioLuporini d6fcbd9
compiler: Avoid CSE across Reserved keywords
FabioLuporini 939a8d8
compiler: Introduce Terminal mixin for SymPy subclasses
FabioLuporini 80a6c12
compiler: Pass ctx down to _map_function_on_high_bw_mem
FabioLuporini 41b8af8
compiler: Enhance _alloc_object_on_low_lat_mem
FabioLuporini c845871
compiler: Fix abstract_object(Array)
FabioLuporini 8dade80
compiler: Avoid spurious items in sub_iters and dirs
FabioLuporini 87ac401
misc: Fix typo
FabioLuporini 4dbb6d1
compiler: Pass kwargs to make_parallel
FabioLuporini 8542126
compiler: Tweak pairwise_or
FabioLuporini abdda07
compiler: Enhance ListInitializer
FabioLuporini 6dcff84
compiler: Bump SafeInv cost
FabioLuporini 489005b
compiler: Fix Cluster.used_dimensions
FabioLuporini 206c29c
compiler: Split up Cluster.used_dimensions to fix Lift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,16 +171,35 @@ def free_symbols(self): | |
| def dimensions(self): | ||
| return set().union(*[i._defines for i in self.ispace.dimensions]) | ||
|
|
||
| @cached_property | ||
| def exprs_dimensions(self): | ||
| """ | ||
| The Dimensions that appear explicitly in the Cluster expressions. | ||
| """ | ||
| dims_explicit = {i for i in self.free_symbols if i.is_Dimension} | ||
| dims_implicit = set().union(*[set(e.implicit_dims) for e in self.exprs]) | ||
| return dims_explicit | dims_implicit | ||
|
|
||
| @cached_property | ||
| def guards_dimensions(self): | ||
| """ | ||
| The Dimensions that appear explicitly in the Cluster guards. | ||
| """ | ||
| syms_guards = set().union(*[e.free_symbols for e in self.guards.values()]) | ||
|
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. You can do the same with this one, which will improve readability and homogeneity |
||
| dims_guards = {i for i in syms_guards if i.is_Dimension} | ||
| return dims_guards | ||
|
|
||
| @cached_property | ||
| def used_dimensions(self): | ||
| """ | ||
| The Dimensions that *actually* appear among the expressions in ``self``. | ||
| These do not necessarily coincide the IterationSpace Dimensions; for | ||
| example, reduction or redundant (i.e., invariant) Dimensions won't | ||
| appear in an expression. | ||
| All the Dimensions that appear explicitly either within the expressions | ||
| or the guards. | ||
|
|
||
| Note that, in some cases, some of the IterationSpace Dimensions might | ||
| not appear here among the used Dimensions -- for example, reduction or | ||
| redundant (i.e., invariant) Dimensions. | ||
| """ | ||
| idims = set.union(*[set(e.implicit_dims) for e in self.exprs]) | ||
| return {i for i in self.free_symbols if i.is_Dimension} | idims | ||
| return self.exprs_dimensions | self.guards_dimensions | ||
|
|
||
| @cached_property | ||
| def dist_dimensions(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
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 |
|---|---|---|
|
|
@@ -789,17 +789,19 @@ def __init__(self, intervals, sub_iterators=None, directions=None): | |
| super().__init__(intervals) | ||
|
|
||
| # Normalize sub-iterators | ||
| sub_iterators = dict([(k, tuple(filter_ordered(as_tuple(v)))) | ||
| for k, v in (sub_iterators or {}).items()]) | ||
| sub_iterators = sub_iterators or {} | ||
| sub_iterators = {d: tuple(filter_ordered(as_tuple(v))) | ||
|
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. That's quite a lot of tuple conversion but doubt can be changed |
||
| for d, v in sub_iterators.items() if d in self.intervals} | ||
| sub_iterators.update({i.dim: () for i in self.intervals | ||
| if i.dim not in sub_iterators}) | ||
| self._sub_iterators = frozendict(sub_iterators) | ||
|
|
||
| # Normalize directions | ||
| if directions is None: | ||
| self._directions = frozendict([(i.dim, Any) for i in self.intervals]) | ||
| else: | ||
| self._directions = frozendict(directions) | ||
| directions = directions or {} | ||
| directions = {d: v for d, v in directions.items() if d in self.intervals} | ||
| directions.update({i.dim: Any for i in self.intervals | ||
| if i.dim not in directions}) | ||
| self._directions = frozendict(directions) | ||
|
|
||
| def __repr__(self): | ||
| ret = ', '.join([f"{repr(i)}{repr(self.directions[i.dim])}" | ||
|
|
@@ -821,8 +823,7 @@ def __lt__(self, other): | |
| return len(self.itintervals) < len(other.itintervals) | ||
|
|
||
| def __hash__(self): | ||
| return hash((super().__hash__(), self.sub_iterators, | ||
| self.directions)) | ||
| return hash((super().__hash__(), self.sub_iterators, self.directions)) | ||
|
|
||
| def __contains__(self, d): | ||
| try: | ||
|
|
||
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
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.
don't need
set(e.implicit_dims)juste.implicit_dimsThere 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.
Could even just be
dims_implicit = {d for e in self.exprs for d in e.implicit_dims}